Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created September 20, 2017 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/d8e013f9a3299a5cfd997c8a7b6f4ccf to your computer and use it in GitHub Desktop.
Save matthieu-D/d8e013f9a3299a5cfd997c8a7b6f4ccf to your computer and use it in GitHub Desktop.
<form [formGroup]="userForm" connect="myForm" (ngSubmit)="onFormSubmitted()">
<div>
<label>
<span>Name</span>
<input type="text" placeholder="Name" formControlName="name">
<p *ngIf="userForm.controls.name.errors">
This field is bad!
</p>
</label>
</div>
<div>
<label>
<span>Email</span>
<input type="email" placeholder="Email" formControlName="email">
</label>
</div>
<div formGroupName="address">
<div>
<label>
<span>Country</span>
<input type="text" placeholder="Country" formControlName="country">
</label>
</div>
<div>
<label>
<span>City</span>
<input type="text" placeholder="City" formControlName="city">
</label>
</div>
</div>
<input type="submit" [disabled]="userForm.invalid">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment