export function FirstNameDirectiveFactory() { return new FirstNameDirective(); } class FirstNameDirective implements angular.IDirective { require = 'ngModel'; restrict = 'A'; link = function (scope, elm, attrs, ctrl) { ctrl.$validators.firstName = function (modelValue, viewValue) { return FirstNameRegex.test(viewValue); } } } const FirstNameRegex = /^((?! and )(?!\&).)*$/