--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
angular.module('directiveModule', []).directive('decimals', [function () {return {require: 'ngModel',link: function($scope, element, attrs, model) {element.bind('blur', function () {var decimals = parseInt(attrs.decimals),value = (!isNaN(element.val()))? parseFloat(element.val()).toFixed(decimals): (0).toFixed(decimals);element.val(value);$scope.$apply(function() {model.$setViewValue(value);});});}};}]);
No setviewvalue only updates the model and doesn't trigger a digest.
Pete
...from my mobile.