Reputation: 306
I'am using ng2-currency-mask module in my Angular 6 project but when apply (change) method in input fields its not working
here i used input tag
<input style="text-align:right; width:260px;" currencyMask [options]="{ prefix: 'Rs ', thousands: ',', decimal: '.' }" (change)="addToAllChange($event.target.value)" placeholder="Value" class="form-control"/>
Upvotes: 2
Views: 8215
Reputation: 11243
You are not able to trigger change
even because of currencyMask
directive. You can leverage ngModel
and ngModelChange
.
<input style="text-align:right; width:260px;" currencyMask
[options]="{ prefix: 'Rs ', thousands: ',', decimal: '.' }"
#currency
(ngModelChange)="addToAllChange(currency.value)"
[(ngModel)]="value"
placeholder="Value"
class="form-control"/>
If you want to control on when it should be updated, you can use ngModelOption
.
Upvotes: 5