angular - Using Pipes within ngModel on INPUT Elements in Angular2-View -
i've html input field.
<input [(ngmodel)]="item.value" name="inputfield" type="text" />
and want format value , use existing pipe:
.... [(ngmodel)]="item.value | usemypipetoformatthatvalue" .....
and error message:
cannot have pipe in action expression
how can use pipes in context?
you can't use template expression operators(pipe, save navigator) within template statement:
(ngmodelchange)="template statements"
(ngmodelchange)="item.value | usemypipetoformatthatvalue=$event"
https://angular.io/docs/ts/latest/guide/template-syntax.html#!#template-expressions
so should write follows:
<input [ngmodel]="item.value | usemypipetoformatthatvalue" (ngmodelchange)="item.value=$event" name="inputfield" type="text" />
Comments
Post a Comment