Cannot have a pipe in an action expression ?

后端 未结 2 536
清歌不尽
清歌不尽 2020-12-31 01:22

I\'m using this statement in my html template:

[(ngModel)]=\"tempProduct.unitprice | number : \'1.2-2\'\"

But when i run it im getting this

2条回答
  •  隐瞒了意图╮
    2020-12-31 02:08

    Perhaps this should work for you:

    [ngModel]="tempProduct.unitprice | number : '1.2-2'" (ngModelChange)="tempProduct.unitprice = $event"
    

    This way "two-way"-binding is split in property-binding and event binding which allows more complex expressions.

提交回复
热议问题