typescript - Angular2: Percent Pipe Not Working When Model Changed to Same Value -


i using p-datatable primefaces. when first loaded values, percent pipe works. value of field1 = 0.1, displays 10%. when change value 10% , typed 20, pipe changes 20%. problem is, when typed 20 again, pipe doesn't format 20%.

<p-datatable [value]="myvalue">     <p-column field="field1" header="field1">         <template let-col let-can="rowdata" let-index="rowindex" ptemplate="body">             <input value="{{can[col.field]|percent}}" (change)="oncellchange($event.target.value, col.field, index)"/>         </template>     </p-column> </p-datatable> 

the typescript:

oncellchange(value: number, field: string, index: number) {     this.myvalue[index][field] = value / 100; } 

use binding square brackets instead of expression.

<input [value]="can[col.field]|percent" (change)="oncellchange($event.target.value, col.field, index)"/> 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -