Ionic JS Six: Toggle switch operation

Source: Internet
Author: User

In the following instance, checked displays different values by toggling different switches, with true turned on and false to off.
HTML Code

<Ion-header-barclass= "Bar-positive">  <H1class= "title">Switch switching</H1></Ion-header-bar>         <ion-content>    <Divclass= "List">        <Divclass= "Item Item-divider">Settings</Div>        <Ion-toggleng-repeat= "Item in Settingslist"Ng-model= "item.checked"ng-checked= "item.checked">{{Item.text}}</Ion-toggle>        <Divclass= "Item">        <!--use the pre tag to show more beautiful results -      <DivNg-bind= "Settingslist | json"></Div>     </Div>        <Divclass= "Item Item-divider">Notifications</Div>        <Ion-toggleNg-model= "pushnotification.checked"Ng-change= "Pushnotificationchange ()">Push Notifications</Ion-toggle>        <Divclass= "Item">        <!--use the pre tag to show more beautiful results -      <DivNg-bind= "Pushnotification | json"></Div>     </Div>        <Ion-toggleToggle-class= "Toggle-assertive"Ng-model= "Emailnotification"Ng-true-value= "' Subscribed '"Ng-false-value= "' unubscribed '">Newsletter</Ion-toggle>        <Divclass= "Item">        <!--use the pre tag to show more beautiful results -      <DivNg-bind= "Emailnotification | json"></Div>     </Div>      </Div>  </ion-content>

Because of the pre tag conflict, the pre in the instance has been replaced with a DIV tag, which can be viewed in "try it."
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

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

?

?

Ionic JS Six: Toggle switch operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.