Reputation: 109
number in <input>
element formatted by this.decimalPipe.transform(...)
User changed value, then I need get this string value from input element and convert it back to number for further actions.
How to do reverse operation - convert string back from decimalPipe result to number?
Upvotes: 3
Views: 2116
Reputation: 521
The best option for me is to use: ng2-currency-mask directive for clean coding.
<input currencyMask [(ngModel)]="value" [options]="{ prefix: 'R$ ', thousands: '.', decimal: ',', precision: 2 }"/>
Upvotes: 1