javascript - Angular.js set input field value using ngModel -


i'm trying make input formats currency using angular.js, preferably when focus lost. here's have far

<div layout-fill>     <md-input-container layout-fill currency class="number-range">         <input placeholder="from"                type="text"                name="from"                precision="{{rangecontroller.precision}}"                ng-blur="pls = {{pls | currency}}"                ng-model="pls"/>     </md-input-container> </div> 

where precision evaluates 2. know wrong (because isn't working), can't find in documentation this, , google talks huge jquery libraries can format in of hundred different international currencies. want use neither jquery, nor external code , seems pretty simple, can't figure out why no 1 has ever tried it.

i believe plunker you're asking. uses directive:

   .directive('blurtocurrency', function($filter){   return {     scope: {       amount  : '='     },     link: function(scope, el, attrs){       el.val($filter('currency')(scope.amount));        el.bind('focus', function(){         el.val(scope.amount);       });        el.bind('input', function(){         scope.amount = el.val();         scope.$apply();       });        el.bind('blur', function(){         el.val($filter('currency')(scope.amount));       });     }   }