Topic: activate app-form-validation on form start
itay pro asked 5 years ago
When populating a form, the values might fail app-form-validation
However, the red warning is displayed only once modifying the value manually or passing using tab
What should I do in order to show the user the warning right after populating the form
Arkadiusz Idzikowski staff answered 5 years ago
You can loop through your form controls and mark them as touched using Angular markAsTouched() method.
itay pro commented 5 years ago
Thanks.
This is the code that works:
for (const i in this.form.controls) this.form.controls[i].markAsTouched();
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.4.0
- Device: NA
- Browser: NA
- OS: NA
- Provided sample code: No
- Provided link: No