Reputation: 3093
When I output a variable like this I can format it to decimal places:
{{variable|number:2}}
How would I do the same thing in a text input?
<input type="text" ng-model="variable">
This doesn't work:
<input type="text" ng-model="variable|number:2">
Upvotes: 0
Views: 171
Reputation: 44
//You can add watch in controller as well. Here is the sample
$scope.$watch('variable', function() {
$scope.variable= "Here add your logic";
});
Upvotes: 0
Reputation: 44
Filter are not allowed to use on ng-model.
Create directive and watch model value and update it upon change.
Upvotes: 1