Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. # component.ts
  2. /**
  3. * Validation message helper
  4. */
  5. public hasError = (controlName: string, errorName: string) => {
  6. return this.formGroup.controls[controlName].hasError(errorName);
  7. }
  8.  
  9. # component.html
  10. <mat-form-field>
  11. <input matInput placeholder="Nachname" formControlName="lastName" required>
  12. <mat-error *ngIf="hasError('lastName', 'required')">Geben Sie einen Namen ein</mat-error>
  13. </mat-form-field>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement