Saturday, January 5, 2019

Why use AbstractFormControl Example?

Answer : AbstractFormControl is abstract class that is used for custom form Control 
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

48 answers on StackOverflow to the most popular Angular questions I gathered the most common questions and answers from Stac...