Angular 4 ngIf检查可变长度以插入条件

时间:2018-05-30 07:08:33

标签: javascript angular forms

这是我需要插入表单的要求,但我不知道如何使用angular4来放置它。

如果国籍是“我的”,    旧IC:xxxxxxx    新IC:xxxxxxxxxxxx 如果不是,长度= 9 如果国籍是“我的”和新IC,请在新IC中使用前6位数进行验证。

如果年龄低于19岁,请提示消息并拒绝注册。

 <div class="form-group">
    <label for="Nationality">Nationality</label>
    <select id="Nationality" name="Nationality" [(ngModel)]="Nationality" class="form-control" >
      <option value ="MY">Malaysian</option>
      <option value ="SG">Singaporean</option>
      <option value ="IN">Indonesian</option>
    </select><br>
  </div>

  <div class="form-group">
      <label>Identity No: </label>
     <input type = "text" name="Identity_No" id="Identity_No" placeholder="Identity No" ngModel #IdentityNo="ngModel" required pattern="[0-9]+"><br>
  </div>
  <div *ngIf="IdentityNo.touched" class="alert alert-danger">
    <div *ngIf="IdentityNo.errors?.required">
      Identity No is required
    </div>
  </div>
  
  <div class="form-group">
    <label>Birthdate: </label>
    <input type = "date" name="Birthdate" id="Birthdate" placeholder="Birthdate" ngModel #Bdate="ngModel" required><br>
  </div>
  <div *ngIf="Bdate.touched" class="alert alert-danger">
    <div *ngIf="Bdate.errors?.required">
      Birth Date is required
    </div>
  </div>

0 个答案:

没有答案