<form [formGroup]="basicForm" (ngSubmit)="submit()">

  <nz-form-item>
    <nz-form-label [nzSpan]="5">原始密码</nz-form-label>
    <nz-form-control [nzSpan]="12" [nzErrorTip]="oldErrorTpl">
      <input nz-input formControlName="old" required/>
      <ng-template #oldErrorTpl let-control>
        <ng-container *ngIf="control.hasError('required')">请输入原始密码!</ng-container>
      </ng-template>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label [nzSpan]="5">新密码</nz-form-label>
    <nz-form-control [nzSpan]="12" [nzErrorTip]="newErrorTpl">
      <input nz-input formControlName="new" required/>
      <ng-template #newErrorTpl let-control>
        <ng-container *ngIf="control.hasError('required')">请输入新密码!</ng-container>
        <ng-container *ngIf="control.hasError('minlength')">长度不能少于{{control.getError("minlength").requiredLength}}</ng-container>
        <ng-container *ngIf="control.hasError('maxlength')">长度不能大于{{control.getError("maxlength").requiredLength}}</ng-container>
      </ng-template>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label [nzSpan]="5">确认密码</nz-form-label>
    <nz-form-control [nzSpan]="12" [nzErrorTip]="new2ErrorTpl">
      <input nz-input formControlName="new2" required/>
      <ng-template #new2ErrorTpl let-control>
        <ng-container *ngIf="control.hasError('required')">请输入确认密码!</ng-container>
        <ng-container *ngIf="control.hasError('diff')">确认密码不一致!</ng-container>
      </ng-template>
    </nz-form-control>
  </nz-form-item>

  <button nz-button nzType="primary">提交</button>

</form>
