Topic: Angular - Validation on Init

Chulos pro asked 5 years ago


Hi, ¿Is there a way to trigger and show input validation messages (data-error="" data-success="") when the components inits? i've tried: updateValueAndValidity() function and the input validity state is updated correctly, but correct/error messages are not shown. Any solutions?   Thank you.

Arkadiusz Idzikowski staff answered 5 years ago


Dear Chulos, You can try to mark your form controls as touched in ngOnInit like this: this.yourFormControl.controls.yourControlName.markAsTouched(); Best, Arek

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags