2
如何爲選擇標籤寫入驗證? 這是我選擇標記的代碼,但我沒有得到select的驗證,消息也沒有出現。在頁面上選擇元素的驗證
HTML代碼
<form>
<ion-list [ngFormModel]="registrationForm">
<ion-item>
<ion-label floating>Preffer Payment<span class="redtxt">*</span></ion-label>
<ion-select ngControl="pay">
<ion-option>Neft/Rtgs/Imps</ion-option>
<ion-option>Debet/Credit</ion-option>
<ion-option>Net Banking</ion-option>
</ion-select>
<div control="pay" class="validation-error">This is required</div>
</ion-item>
</ion-list>
<form>
TS碼
public registrationForm:any;
constructor(public navCtrl: NavController,public _form: FormBuilder) {
this.registrationForm = this._form.group({
"pay":["",Validators.required]
})
}