jQuery Mask Plugin Integration with Angular.js
Simple example showing how to integrate jQuery Mask Plugin with Angular.js
by igorescobar
HTML
<script src="https://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js"></script>
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.min.js"></script>
<div ng-app="myApp">
<h1>jQuery Mask Plugin integration with Angular.js</h1>
<h3>Simple example</h3> <br />
<div ng-controller="FormController">
<label>Date: </label> <br />
<input id="date" ui-date>
</div>
</div>
CSS
body { margin: 50px; }
h1 { font-size: 26px; margin-bottom: 10px; }
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('uiDate', function() {
return {
require: '?ngModel',
link: function($scope, element, attrs, controller) {
element.mask("00/00/0000");
}
};
});
function FormController() {
}