I have form with field validation which works as expected when entering the 
field.
I want the error message will display also when submitting...

<form [formGroup]="catForm" novalidate (ngSubmit)="onSubmit()">
<div class="col-lg-12"><input type="submit" class="btn btn-info" value="Add"
> <input type="button" (click)="editCatSubmit()" class="btn btn-info" value=
"edit"></div>
<div class="col-lg-12"><input type="text" [(ngModel)]='categoryName' name=
"catName" formControlName="catName" placeholder="Category name" required>
<div>
<p class="error" *ngIf="!catForm.controls['catName'].valid && 
catForm.controls['catName'].touched ">Category is required</p>
</div>
</div>
</form>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to