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('userInputPattern', function () {
return {
restrict: 'A',
require: 'ngModel',
link:function(scope, elem, attrs, ngModelCtrl) {
var prevModel = ngModelCtrl.$viewValue;
var userPattern = scope.$eval(attrs.userInputPattern) ? new RegExp(scope.$eval(attrs.userInputPattern)) : /^.*$/;
var onChange = function(newVal) {
if(angular.isDefined(newVal) && newVal && !userPattern.test(newVal)) {
ngModelCtrl.$setViewValue(prevModel);
ngModelCtrl.$commitViewValue();
ngModelCtrl.$render();
} else {
prevModel = newVal || '';
}
return prevModel;
};
ngModelCtrl.$parsers.push(onChange);
}
};
});
});