Summary Table
| Categories |
Total Count |
| PII |
0 |
| URL |
0 |
| DNS |
0 |
| EKL |
0 |
| IP |
0 |
| PORT |
0 |
| VsID |
0 |
| CF |
0 |
| AI |
0 |
| VPD |
0 |
| PL |
0 |
| Other |
0 |
File Content
define(['app', 'angular'], function (app, angular) {
app.directive('alphanumericOnly', function ($timeout) {
return {
restrict: 'A',
require: 'ngModel',
scope: {
'ngModel': '=',
'alphanumericOnly': '='
},
link:function(scope, elem, attrs, ngModelCtrl) {
if(scope.alphanumericOnly) {
ngModelCtrl.$parsers.push(function(newVal) {
if (newVal == undefined)
return '';
var transformedInput = newVal.replace(/[^0-9A-Za-z ]/g, '');
if (transformedInput !== newVal) {
ngModelCtrl.$setViewValue(transformedInput);
ngModelCtrl.$commitViewValue();
ngModelCtrl.$render();
//ngModelCtrl.$validate();
if(transformedInput == "" && attrs.ngRequired) {
ngModelCtrl.setValidity("required", true);
}
}
return transformedInput;
});
}
}
};
});
});