Guest User

Untitled

a guest
Jun 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <form [formGroup]="myForm" (ngSubmit)="onSubmit()">
  2. <mat-form-field class="example-full-width">
  3. <input matInput placeholder="What is your name" [formControl]="myForm.controls['name']"/>
  4. <mat-error *ngIf="myForm.controls['name'].hasError('required')">Required!</mat-error>
  5. <mat-error *ngIf="myForm.controls['name'].hasError('maxlength')">Too long!</mat-error>
  6. </mat-form-field>
  7. <button mat-raised-button color="primary" type="submit" [disabled]="!form.isValid">Submit</button>
  8. </form>
Add Comment
Please, Sign In to add comment