标签:com put index dex ror pre dirty str can
<div class="form-field"> <label>Confirm Password: </label> <input type="text" formControlName="confirm" [(ngModel)]="signup.confirm" name="confrim"> <div *ngIf="!signupForm.valid"> <span *ngIf="signupForm.get(‘confirm‘).hasError(‘confirmPassword‘) && signupForm.get(‘confirm‘).touched"> {{signupForm.get(‘confirm‘).errors?.confirmPassword.message}} </span> <span *ngIf="signupForm.get(‘confirm‘).hasError(‘required‘) && signupForm.get(‘confirm‘).dirty">This field is requred</span> </div> </div>
‘signupForm‘ is a formGroup.
we can use ‘hasError‘ & ‘get()‘ methods to write the code.
[Angular2 Form] Validation message for Reactive form
标签:com put index dex ror pre dirty str can
原文地址:http://www.cnblogs.com/Answer1215/p/6012368.html