<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Todo</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <script src="lib/ionic/js/ionic.bundle.js"></script> <script src="js/app.js"></script> <!-- 在使用 Cordova/PhoneGap 创建的 APP 中包含的文件,由 Cordova/PhoneGap 提供,(开发过程中显示 404) --> <script src="cordova.js"></script> <script> var app = angular.module("myApp",["ionic"]); app.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(); } }); }); app.controller( 'myCtrl01',['$scope','$http','$timeout' ,function($scope,$http,$timeout){ $scope.items=[ {name:"朱明宇",checked:true}, {name:"宋玉清",checked:false}, {name:"李俊",checked:false} ]; $scope.singleChoice=[ {name:"影流之主",value:"劫"}, {name:"疾风剑豪",value:"亚索"}, {name:"傲之追猎者",value:"狮子狗"}, {name:"暗夜猎手",value:"VN"}, {name:"暴走萝莉",value:"金克斯"} ]; $scope.data={ clientSide: '劫' }; }]); </script> </head> <body ng-app="myApp" ng-controller="myCtrl01"> <ion-pane> <ion-header-bar class="bar bar-header positive-bg"> <h1 class="title" style="color: #ffffff;">复选框</h1> </ion-header-bar> <ion-content class="content has-header"> <div class="list"> <!--复选框--> <div class="item item-divider">复选框</div> <ion-checkbox class="item" ng-repeat="x in items" ng-model="x.checked" ng-checked="x.checked">{{x.name}}</ion-checkbox> <div class="item"><pre ng-bind="items|json"></pre></div> <!--单选框--> <div class="item item-divider" style="background: #ff705e;">单选框:{{data.clientSide}}</div> <ion-radio class="item" ng-repeat="item in singleChoice" ng-value="item.value" ng-model="data.clientSide">{{item.name}}</ion-radio> <!--切换开关的操作--> <div class="item item-divider energized-bg">切换开关的操作</div> <ion-toggle class="item" ng-repeat="x in items" ng-model="x.checked" ng-checked="x.checked">{{x.name}}</ion-toggle> <div class="item"><pre ng-bind="items|json"></pre></div> </div> </ion-content> </ion-pane> </body> </html>
转载于:https://my.oschina.net/YongfengHe/blog/743024