如何在角度2中显示危险信息

时间:2016-12-14 06:38:59

标签: javascript angular ionic-framework ionic2

创建了First_Name和Last_Name表单。 Angular 2中是否有任何通用表单验证器,我也在客户端显示了错误消息。如何展示危险!!

贝娄是我的代码

html文件

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

<ion-item>
  <ion-label primary floating>FIRST NAME</ion-label>
  <ion-input type="text" id="firstname" class="form-control" formControlName="firstname" minlength="4" maxlength="12" required ></ion-input>
</ion-item>  
  <p *ngIf="myForm.controls.firstname.errors && myForm.controls.firstname.dirty " danger > FirstName is required (b/w 4-12 chars)</p>
<ion-item>
  <ion-label primary floating>LAST NAME</ion-label>
  <ion-input type="text" id="lastname" class="form-control" formControlName="lastname" minlength="4" maxlength="10" required ></ion-input>
</ion-item>
  <p *ngIf="myForm.controls.lastname.errors && myForm.controls.lastname.dirty " danger> LastName is required (b/w 1-10 chars)</p>
</form>

告诉我显示错误信息的危险性!

1 个答案:

答案 0 :(得分:0)

chmod 777 counter.txt