ionic book


layout: "docs_api" version: "1.1.0" versionHref: "/docs" path: "api/directive/ionToggle/"

title: "ion-toggle" header_sub_title: "Directive in module ionic" doc: "ionToggle"

docType: "directive"

ion-toggle

A toggle is an animated switch which binds a given model to a boolean.

Allows dragging of the switch's nub.

The toggle behaves like any AngularJS checkbox otherwise.

Usage

Below is an example of a toggle directive which is wired up to the airplaneMode model and has the toggle-calm CSS class assigned to the inner element.

<ion-toggle ng-model="airplaneMode" toggle-class="toggle-calm">Airplane Mode</ion-toggle>

API

Attr Type Details
toggle-class
(optional)
string

Sets the CSS class on the inner label.toggle element created by the directive.