Richard Richard - 1 year ago 117
TypeScript Question

How to default a ion-toggle to on?

I am using an

in Ionic 2, that I would like to default to on. I have tried the
attribute, but it still defaults to off.

<ion-toggle [(ngModel)]="" formControlName="contact" id="contact" checked="true">Contactable</ion-toggle>

How do I default a
to true or on?


Answer Source

In your Component code, set the property to true: = true;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download