Skip to content

Instantly share code, notes, and snippets.

@djabif
Created April 30, 2018 00:33
Show Gist options
  • Save djabif/f03b66c40c2e1779201eb1b1067b8045 to your computer and use it in GitHub Desktop.
Save djabif/f03b66c40c2e1779201eb1b1067b8045 to your computer and use it in GitHub Desktop.
<form [formGroup]="userDetailsForm" (ngSubmit)="onSubmitUserDetails(userDetailsForm.value)">
<mat-form-field class="full-width">
<input matInput placeholder="Full Name" formControlName="fullname" required>
<mat-error *ngFor="let validation of validation_messages.fullname">
<mat-error class="error-message" *ngIf="userDetailsForm.get('fullname').hasError(validation.type) && (userDetailsForm.get('fullname').dirty || userDetailsForm.get('fullname').touched)">{{validation.message}}</mat-error>
</mat-error>
</mat-form-field>
<button class="submit-btn" color="primary" mat-raised-button type="submit" [disabled]="!userDetailsForm.valid">Submit</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment