I am new to Angular and am trying to unserstand basic form validation code. here the below checkValidEmail is trying to check if user input email is equal to [email protected]. What I am not understanding is when email is [email protected] why the form validation is false? For the full source code - https://stackblitz.com/edit/angular-p4bz6e?file=src%2Fapp%2Fapp.component.ts
checkValidEmail(control: AbstractControl) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (control.value === '[email protected]') {
resolve({ test: false })
} else {resolve(null)}
}, 2000)
})