Time for me to feel stupid :/ Anyone an idea why t...
# package-development
d
Time for me to feel stupid :/ Anyone an idea why this validator just doesn't want to register?
Copy code
(function () {
    "use strict";

    angular.module("umbraco")
    .directive("nameValidator", nameValidator);

    function nameValidator() {
        console.log("Hello from validator");
        return {
            require: "ngModel",
            link: function (scope, elm, attrs, ctrl) {
                ctrl.$validators.nameValidator = function (modelValue, viewValue) {
                    if (ctrl.$isEmpty(modelValue)) {
                        return true;
                    }

                    if (viewValue.indexOf(B) === -1) {
                        return false;
                    }
                };
            }
        }
    }
})();
The console.log is never called 😦