Answer : AbstractFormControl is abstract class that is used for custom form Control
and validation. Example :
emailDomain(domainName: string) {
and validation. Example :
emailDomain(domainName: string) {
return (params: AbstractControl): { [key: string]: any } | null => {
const email: string = params.value;
const domain = email.substring(email.lastIndexOf('@' + 1));
if (email === '' || domain.toLowerCase() === domainName.toLowerCase()) {
return null;
} else {
return { 'emailDomain': true };
}
};
No comments:
Post a Comment