I am trying to use the currency
pipe on an ion-input
element as follows.
<ion-input type="number" name="amount"
[ngModel]="myObject.amount | currency"
(ngModelChange)="myObject.amount = $event">
</ion-input>
When I use this one-way binding + event approach, the input field is blank on the UI. If I inspect element, I see the ng-reflect-model="$100"
attribute value on the generated input
element. If I change the type
to text, however, I do see the rendered value of $100.
<ion-input type="text" name="amount"
[ngModel]="myObject.amount | currency"
(ngModelChange)="myObject.amount = $event">
</ion-input>
The problem is now I lose the numeric keyboard if type="text"
instead of type="number"
. Any ideas on how to make this work with showing the numeric keyboard?
I am using ionic-angular v3.9.2.