This directive doesn't work on server after minification. It gives the following error:
Error: [$injector:unpr] http://errors.angularjs.org/1.7.5/$injector/unpr?p0=eProvider%20%3C-%20e%20%3C-%20gwsRegexDirective at angular.js:99 at angular.js:4905 at Object.d [as get] (angular.js:5065) at angular.js:4910 at d (angular.js:5065) at e (angular.js:5090) at Object.invoke (angular.js:5114) at angular.js:8756 at r (angular.js:387) at Object.<anonymous> (angular.js:8754)
app.directive('gwsRegex', function ($compile) {
return {
restrict: 'A',
link: function (scope, element, attrs, ngModelCtrl) {
element.bind('keyup', () => {
let _regex = new RegExp(attrs['gwsRegex']);
var _value = element[0].value;
if (_value.match(_regex)) {
element[0].value = _value.replace(_value.match(_regex)[0], '').trim()
}
});
}
};
});