【发布时间】:2016-12-18 13:30:57
【问题描述】:
我正在使用 Ionic 2 和 Angular 2 beta 11。
如何关闭拨动开关?查看 Ionic documentation,它建议使用 checked 属性。但是,我已经尝试过这个以及ng-checked,但没有成功。
有什么建议吗?
<ion-item>
<ion-label>Drivers Licence</ion-label>
<ion-toggle checked="false" id="driversLicence" formControlName="driversLicence">Drivers Licence</ion-toggle>
</ion-item>
更新:
好像我有formControlName="driversLicence",切换开关总是打开。这是为什么?因为我需要formControlName,我怎样才能让它工作?
我需要访问driversLicence,我这样做如下:
this.jobdetailsForm.value.driversLicence
或
在提交表单时如何在不使用formControlName 的情况下获取driversLicence 值?我尝试以下,但它是null。
document.getElementById('driverLicence')
【问题讨论】:
-
好像我有
formControlName="driversLicence",切换开关总是打开的。这是为什么?因为我需要formControlName,我怎样才能让它工作?
标签: javascript angularjs angular ionic-framework ionic2