I have a child component call app-account included a submit form with some input fields validattors like this
this.user = this.fb.group({
usrname: new FormControl('', Validators.compose([Validators.required])),
password: new FormControl('', Validators.compose([Validators.required, Validators.minLength(6)]))});
and in HTML template
<form [formGroup]="user" (ngSubmit)="onSubmit()">
<mat-form-field>
<input matInput placeholder="Account" formControlName="usrname">
<mat-error *ngIf="!!user.controls.usrname.errors?.required">{{usrrequire_msg}}
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput type="password" placeholder="Password" formControlName="password">
<mat-error *ngIf="!!user.controls.password.errors?.required">
{{pwrequire_qmsg}}
</mat-error>
<mat-error *ngIf="!!user.controls.password.hasError('minlength')">
{{pwminimum_msg}}
</mat-error>
</mat-form-field>
I embedded this component like a child comp to a parent component HTML
<app-account></app-account>
and in the parent component i have a button to Submit
Layout is load fine but when i click submit button from parent component with any clicking or touching to child input field => Have not any error validate message is display?
How can i resolve it, thanks!