Created
February 24, 2023 00:49
-
-
Save shadow1349/d92304e8df59cb360058270111cc052e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form #myForm="ngForm" (ngSubmit)="onSubmit()"> | |
<div ngModelGroup="user"> | |
<label> | |
Name: | |
<input type="text" name="name" [(ngModel)]="name" required> | |
</label> | |
<div *ngIf="myForm.controls['user']?.controls['name'].invalid && myForm.controls['user']?.controls['name'].touched"> | |
<div *ngIf="myForm.controls['user']?.controls['name'].errors.required">Name is required</div> | |
</div> | |
</div> | |
<button type="submit">Submit</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment