Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ionic Toggle Operations

ionic Toggle Operations

In the following example, different values are displayed by toggling different switches; checked, true means on, false means off.

HTML Code





  

开关切换

Settings
{{ item.text }}
    
Notifications
Push Notifications
    
Newsletter
    

Due to a conflict with the pre tag, pre in the example has been replaced with a div tag; see "Try it" for details.

JavaScript Code



angular.module('ionicApp', ['ionic'])



.controller('MainCtrl', function($scope) {



  $scope.settingsList = [

    { text: "Wireless", checked: true },

    { text: "GPS", checked: false },

    { text: "Bluetooth", checked: false }

  ];



  $scope.pushNotificationChange = function() {

    console.log('Push Notification Change', $scope.pushNotification.checked);

  };

  

  $scope.pushNotification = { checked: true };

  $scope.emailNotification = 'Subscribed';

  

});

css code:



body {

  cursor: url('http://www.runoob.com/try/demo_source/finger.png'), auto;

}

The effect is shown below: