案例:ionic案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html ng-app="mySuperApp">
2
    <head>
3
        <meta charset="utf-8">
4
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
5
        <title>W3xue教程(w3xue.com)</title>
6
        <link href="/css/ionic1.0.1/ionic.min.css" rel="stylesheet">
7
        <script src="/js/ionic1.0.1/ionic.bundle.min.js"></script>
8
        <script type="text/javascript">
9
        angular.module('mySuperApp', ['ionic'])
10
        .controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {
11
12
         // Triggered on a button click, or some other target
13
         $scope.showPopup = function() {
14
           $scope.data = {}
15
16
           // 自定义弹窗
17
           var myPopup = $ionicPopup.show({
18
             template: '<input type="password" ng-model="data.wifi">',
19
             title: 'Enter Wi-Fi Password',
20
             subTitle: 'Please use normal things',
21
             scope: $scope,
22
             buttons: [
23
               { text: 'Cancel' },
24
               {
25
                 text: '<b>Save</b>',
26
                 type: 'button-positive',
27
                 onTap: function(e) {
28
                   if (!$scope.data.wifi) {
29
                     // 不允许用户关闭,除非输入 wifi 密码
30
                     e.preventDefault();
31
                   } else {
32
                     return $scope.data.wifi;
33
                   }
34
                 }
35
               },
36
             ]
37
           });
38
           myPopup.then(function(res) {
39
             console.log('Tapped!', res);
40
           });
41
           $timeout(function() {
42
              myPopup.close(); // 3秒后关闭弹窗
43
           }, 3000);
44
          };
45
           //  confirm 对话框
46
           $scope.showConfirm = function() {
47
             var confirmPopup = $ionicPopup.confirm({
48
               title: 'Consume Ice Cream',