I’m missing something.
I have an input number field. I’m expecting a dollar amount.
But I need to do some checking on this field (if the amount is less then another amount do one thing, if its equal do something else).
The point being is I was expecting the value to be a number so I can check 5 > 3.
When I do this [(ngModel)]=“amount” the value is a string “5.00” I have to convert it. (On the TypeScript side my amount is type number so TypeScript says I can’t pass a number to parseFloat because its expecting it to be a string).
I was thinking I maybe could do it just one way binding (from view to component) I try both
(ngModelChange)=“amount = $event”
or
(ngModel)=“amount”
I don’t think that would have worked the way I think. But the value I get back is undefined.
What is going on?