Skip to content

Instantly share code, notes, and snippets.

@kbailles
Created August 10, 2016 18:49
Show Gist options
  • Save kbailles/9a9e8e1af630ac2c361290ca7ba1dd85 to your computer and use it in GitHub Desktop.
Save kbailles/9a9e8e1af630ac2c361290ca7ba1dd85 to your computer and use it in GitHub Desktop.
Look at this
<form (ngSubmit)="save()" #projectForm="ngForm">
<div>
<input [(ngModel)]="project.name"
required
name="name"
#name="ngModel">
</div>
<div [hidden]="name.valid || name.pristine" class="alert">
Name is required
</div>
<div>
<button [disabled]="!projectForm.valid" type="submit">Save</button>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment