Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # component.ts
- /**
- * Validation message helper
- */
- public hasError = (controlName: string, errorName: string) => {
- return this.formGroup.controls[controlName].hasError(errorName);
- }
- # component.html
- <mat-form-field>
- <input matInput placeholder="Nachname" formControlName="lastName" required>
- <mat-error *ngIf="hasError('lastName', 'required')">Geben Sie einen Namen ein</mat-error>
- </mat-form-field>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement