Reputation: 7
<ion-col size="4">
<ion-input
class="input-field"
style="--padding-end: 20px; text-align: end;"
[(ngModel)]="discountPercent"
(ngModelChange)="onDiscountPercentChange()"
type="text"
appDecimalPlaces="2">
<p slot="end">%</p>
</ion-input>
</ion-col>
Your text:
[(ngModel)]="discountAmount"
I want to add this place format function
getFormatedNumber(saleDecimals)
How can I solve this?
Upvotes: 0
Views: 87
Reputation: 104
First of all the question feels like incomplete but i assume you need to format the model value from input using your custom function
To do that, we can leverage the already called onDiscountPercentChange
and with in that just run the getFormatedNumber(saleDecimals)
like in
onDiscountPercentChange(): void {
// run the format fn
this.getFormatedNumber(2);
}
Upvotes: 0