How can I format numbers in Angular?
Here is the code snippet:
applyIfRisk = function(slip) {
_.assign(slip, {
risk: slip.risk,
win: Math.ceil(slip.risk * 1.67)
});
}, applyIfWin = function(slip) {
_.assign(slip, {
risk: Math.ceil(slip.win * 1.11),
win: slip.win
});
}
This code is connected to the following HTML:
<input ng-model="slip.win"
ng-change="riskWinCalculations(slip, 'WINIFBET')">
<input ng-model="slip.risk"
ng-change="riskWinCalculations(slip, 'RISKIFBET')">
However, it returns an unformatted number like 100000
, when I need it to be displayed as 100,000
.
I was advised to use {{slip.win | number}}
, but since this is a model and not an expression, I am unable to use it.
What should be my next step?
UPDATE
Some have suggested that my question is similar to another, however, the answers provided there do not solve my issue.