I'm trying to change the ngModel (input type="number") Format. This code work good in angularjs 1.2.23 version as you see, but in 1.6.4 version not work. any other solution?
Output must be: 25,00
var app= angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.test=25;
})
.directive('price', function($filter) {
return {
restrict: 'A',
require: '?ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$formatters.push(function (value) {
return $filter('number')(value,2);
});
}
}
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<input type="number" ng-model="test" price>
</div>