Use the following code to check the value of the required element.
<div *ngIf="fname.touched && fname.invalid" class="alert">
<p *ngIf="fname.errors?.['required']">FirstName is mandatory</p>
<p *ngIf="fname.invalid">Invalid First Name</p>
</div>
No comments:
Post a Comment