Reputation: 8945
I am using Ionic 2 with Angular 2 beta 11.
How do you switch off the toggle switch? Looking at the Ionic documentation, it suggests to use a checked
attribute. However, I have tried this as well as ng-checked
with no success.
Any suggestions please?
<ion-item>
<ion-label>Drivers Licence</ion-label>
<ion-toggle checked="false" id="driversLicence" formControlName="driversLicence">Drivers Licence</ion-toggle>
</ion-item>
UPDATE:
It seems like if I have the formControlName="driversLicence"
, the toggle switch is always on. Why is that? How can I get this to work because I need the formControlName
?
I need to access the driversLicence
, which I do as follows:
this.jobdetailsForm.value.driversLicence
OR
How can I get the driversLicence
value without using a formControlName
when the form submits? I try the following, but it is null
.
document.getElementById('driverLicence')
Upvotes: 1
Views: 2070