Although there may be an entirely different way to achieve this, here is an addition to include eliminating letters from the currency on key stroke:
onChangePrice(evt) {
this.box_price = evt.replace(/[^0-9.]/g, "");
if (this.box_price) {
this.box_price_formatted = this.getCurrency(this.box_price)
console.log("box_price_formatted: " + this.box_price_formatted);
}
}
onPriceUp(evt){
this.box_price = evt.replace(/[^0-9.]/g, "");
this.box_price_formatted = String(this.box_price);
}
<ion-input type="string" elastic placeholder='{{placeholder}}' [(ngModel)]="box_price_formatted" (change)='onChangePrice($event.target.value)' (keyup)="onPriceUp($event.target.value)"></ion-input>
Not glamorous but gets the job done.