jQuery Mask Plugin Integration with Angular.js

Simple example showing how to integrate jQuery Mask Plugin with Angular.js

HTML

<script src="https://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular.min.js"></script>
<div ng-app="myApp">
  <div ng-controller="frmtest">
  
    <h1>jQuery Mask Plugin integration with Angular.js</h1>
    <h3>Simple example</h3> <br />
    <div>
        <label>How do I enter: </label> <br />
        <input ng-model="maskedvalue" imp-mask mask="#0.0"/><br/>
        <label>how do I receive it</label><br/>
        <div>{{maskedvalue}}</div>
    </div>

  </div>
</div>

CSS

body { margin: 50px; }
h1 { font-size: 26px; margin-bottom: 10px; }

JavaScript

var myApp = angular.module('myApp', []);

myApp.directive('impMask', function () {
        return {
            scope: {
                mask: "@",
            },
            require: 'ngModel',
            link: function (scope, element, attrs, ngModel) {
                $(element).mask(scope.mask,{
                	reverse:true
                });
            }
        };
    });
  myApp.controller('frmtest', function ($scope) {
  	$scope.maskedvalue="3";
  });