angular 4 : custom validator not working
问题 I pulled this example from angular official doc. I noticed that the custom validation is working with the reactive forms but it is not working with template-driven forms. Here is the plunker of the mentioned example the directive: export function forbiddenNameValidator(nameRe: RegExp): ValidatorFn { return (control: AbstractControl): {[key: string]: any} => { const forbidden = nameRe.test(control.value); return forbidden ? {'forbiddenName': {value: control.value}} : null; }; } @Directive({