Cannot read property 'touched' of undefined

The complete path to the field is:

formName.get('custdetails.email')

So you need to access:

formName.get('custdetails.email').touched

Also, you have an error in the form model. When multiple validators are applied to the same field, they should be wrapped inside an array:

// Replace that:
email: ["", Validators.required, ValidationHelper.emailValidator]
// With this:
// Notice the additional [ ] around the validators
email: ["", [Validators.required, ValidationHelper.emailValidator]]

By passing the two validators as separate parameters, Angular interprets the second validator emailValidator as an async validator and it tries to subscribe to it. Hence the error message "_this.subscribe is not a function".


add in TS file

get email(){ return this.formName.get('custdetails.email'); }

add validation in html

*ngIf="email.touched"