确认未在角形材料中验证密码

时间:2019-03-07 07:21:44

标签: angular

这是我的代码。如果我输入错误,请确认密码,它不会显示密码不匹配。

我该如何用角度验证这一点。

          <mat-form-field>
              <input matInput id="password" name="password" type="password" [(ngModel)]="password" required minlength="6"
              #passwordValidation="ngModel">
            <mat-error *ngIf="passwordValidation.hasError('required')">Required</mat-error>
            <mat-error *ngIf="passwordValidation.hasError('minlength')">Password should be of minimum 6 characters</mat-error>
          </mat-form-field>
          <mat-form-field>
              <input matInput name="confirmPassword" type="password"[(ngModel)]="confirmPassword" required validateEqual="password"
              #confirmPasswordValidation="ngModel" placeholder="Confrim password*">
            <mat-error *ngIf="confirmPasswordValidation.hasError('required')">Required</mat-error>
            <mat-error *ngIf="confirmPasswordValidation.hasError('validateEqual')">Password does not match</mat-error>
          </mat-form-field>

0 个答案:

没有答案