Is there any way to convert string as object property in angular? eg:
getErrorMessage(error_type) {
return this.userForm.controls.{error_type}.hasError('required') ? 'You must enter a value' : '';
}
getErrorMesssage('email');
The function should work something like
return this.userForm.controls.email.hasError('required') ? 'You must enter a value' : '';