|
| 1 | +<div style="width: 40%; text-align: center;margin: auto"> |
| 2 | + <img src="assets/images/logo-blu.svg"/> |
| 3 | +</div> |
| 4 | +<h2 style="text-align: center">xtream validation errors</h2> |
| 5 | +<form [formGroup]="heroForm" validationContext="NEW_HERO" innerValidationError="true" #firstForm> |
| 6 | + |
| 7 | + |
| 8 | + <div style="display:flex;flex-direction: column;"> |
| 9 | + <mat-form-field *ngxValidationErrors="heroForm.get('name'); errors as errors"> |
| 10 | + <input matInput formControlName="name" placeholder="name"/> |
| 11 | + <mat-error *ngIf="errors">{{errors}}</mat-error> |
| 12 | + </mat-form-field> |
| 13 | + </div> |
| 14 | + |
| 15 | + <div style="display:flex;flex-direction: column;"> |
| 16 | + <mat-form-field *ngxValidationErrors="heroForm.get('surname'); errors as errors"> |
| 17 | + <input matInput formControlName="surname" placeholder="surname"/> |
| 18 | + <mat-error *ngIf="errors">{{errors}}</mat-error> |
| 19 | + </mat-form-field> |
| 20 | + </div> |
| 21 | + |
| 22 | + <button mat-raised-button color="primary" [disabled]="heroForm.invalid">Submit</button> |
| 23 | + <button mat-flat-button color="secondary" (click)="clearForm()">Clear</button> |
| 24 | + |
| 25 | +</form> |
| 26 | + |
| 27 | +<form [formGroup]="heroForm" validationContext="USER.REGISTRATION"> |
| 28 | + <div style="display:flex;flex-direction: column;"> |
| 29 | + <mat-form-field *ngxValidationErrors="heroForm.get('name');errors as errors"> |
| 30 | + <input matInput formControlName="name" placeholder="name"/> |
| 31 | + <mat-error *ngIf="errors">{{errors}}</mat-error> |
| 32 | + </mat-form-field> |
| 33 | + </div> |
| 34 | + |
| 35 | + <div style="display:flex;flex-direction: column;"> |
| 36 | + <mat-form-field *ngxValidationErrors="heroForm.get('surname');errors as errors"> |
| 37 | + <input matInput formControlName="surname" placeholder="surname"/> |
| 38 | + <mat-error *ngIf="errors">{{errors}}</mat-error> |
| 39 | + </mat-form-field> |
| 40 | + </div> |
| 41 | + |
| 42 | + <button mat-raised-button color="primary" [disabled]="heroForm.invalid">Submit</button> |
| 43 | + |
| 44 | +</form> |
0 commit comments