I'm trying to use Input Mask jQuery plugin as a directive but getting the following error in Chrome's console errors.
TypeError: Cannot read property 'length' of undefined
My code
JS
var app = angular.module('app', ['ngResource']);
app.directive('inputMask', function(){
return {
restrict: 'A',
link: function(scope, element){
element.mask();
}
}
})
HTML
<input type="text" class="form-control input-mask" data-input-mask data-mask="{mask: 00/00/0000}" placeholder="eg: 23/05/2014">
http://plnkr.co/edit/Kp3SYS0cbIfVm1gTwtE0?p=preview
Please help me fix this.