I am looking to create a custom validator for reactive forms. I plan on implementing it like this:
export class CustomValidators {
isMemberOf(allowedValues: any[]) {
return (ctrl: AbstractControl) => {
//whatever
};
}
}
How can I define this method so that it becomes a part of the existing Validators
class provided by the forms module? This way, it can be accessed using Validators.isMemberOf(...)
similar to how we use Validators.required
.