ERROR TypeError: Cannot read property 'hasError' of undefined
Hi I am facing this below error for the code I have pasted . My angular version is 7.24.
core.js:15724 ERROR TypeError: Cannot read property 'hasError' of undefined
at CustomerComponent.push../src/CustomerApp/Customer/CustomerApp.component.ts.CustomerComponent.hasError (CustomerApp.component.ts:29)
at Object.eval [as updateRenderer] (CustomerComponent.ngfactory.js:11)
at Object.updateRenderer (core.js:23656)
at checkAndUpdateView (core.js:23312)
at callViewAction (core.js:23548)
at execEmbeddedViewsAction (core.js:23511)
at checkAndUpdateView (core.js:23308)
at callViewAction (core.js:23548)
at execComponentViewsAction (core.js:23490)
at checkAndUpdateView (core.js:23313)
hasError(typeOfValidator: string, controlName: string): boolean {
console.log("hi inside code.")
return this.CustomerModel
.customerFormGroup
.contains[controlName]
.hasError(typeOfValidator);
}