You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (this.validErrorMsgService.validationErrorObj.length === 0) {
50
+
this.fieldInfoMsgArr = res['fieldInfo'];
51
+
console.log('Field Info Array => ', this.fieldInfoMsgArr);
52
+
this.isLoading = false;
53
+
}
54
+
}, (error) => {
55
+
console.log(error);
56
+
this.isLoading = false;
57
+
});
68
58
}
69
59
```
70
60
71
61
Now i have to create a directive validation-label.directive.ts will run on the status change of the form control elements. It requires a ‘formControlName’ attribute added to the control. This will be used to used to construct the key that will be passed to the validation service class. The above directive will handle the change/blur events on controls and displays the messages accordingly.
72
-
73
-
Few things to notice in this class are that I defined ‘statusChangeSubscription’ to listen to status changes on the control and remove/add error message depending on the status (INVALID). Also we unsubscribe it on destroy class. And I defined a helper method to construct the message key, get the error message from service class and display it on the view.
0 commit comments