Reputation: 11324
I'm a newbie on angularJS.
I want to divide 2 numbers, but I want to round the result with two digits.
I try many things :
<input type="number" ng-model="var3" ng-value="var3 = Math.round((var1/var2)*100)/100" />
<input type="number" ng-model="var3" ng-value="var3 = (var1/var2).toFixed(2)" />
Do you have any ideas ?
Upvotes: 0
Views: 1441
Reputation: 14543
Not sure how to do it with ng-model
and ng-value
but this filter works fine:
<input type="number" value="{{ var3=var1/var2 | number:2 }}" />
Upvotes: 1