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

ionic Checkbox

ionic Checkbox

The ionic checkbox is no different from a regular HTML checkbox; the following example demonstrates the use of the ionic checkbox ion-checkbox.



复选框标签


Example

In the example, the checked value is modified according to whether the checkbox is selected; true means selected, false means not selected.

HTML Code





  

复选框

{{ item.text }}
Notifications
Push Notifications
Newsletter

JavaScript Code



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



.run(function($ionicPlatform) {

$ionicPlatform.ready(function() {

  // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard

  // for form inputs)

  if(window.cordova && window.cordova.plugins.Keyboard) {

    cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

  }

  if(window.StatusBar) {

    StatusBar.styleDefault();

  }

});

})



.controller( 'actionsheetCtl',['$scope',function($scope){



  $scope.devList = [

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

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

      { text: "JavaScript", 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: