forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodal.html
More file actions
172 lines (153 loc) · 5.85 KB
/
modal.html
File metadata and controls
172 lines (153 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html ng-app="modalTest">
<head>
<meta charset="utf-8">
<title>Modal</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
<script src="../../../../dist/js/ionic.bundle.js"></script>
<script src="dom-trace.js"></script>
</head>
<body>
<ion-pane ng-controller="AppCtrl">
<ion-header-bar class="bar-positive" title="Contacts">
<h1 class="title">Modal</h1>
<div class="buttons">
<button class="button" ng-click="modal.show()">Modal</button>
</div>
</ion-header-bar>
<ion-content class="has-header">
<ion-list>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input ng-focus="openModal()" type="text" placeholder="Email">
</label>
<button class="button button-small">
Cancel
</button>
</div>
<ion-item ng-repeat="contact in contacts">
{{contact.name}}
</ion-item>
</ion-list>
</ion-content>
</ion-pane>
<script id="modal.html" type="text/ng-template">
<ion-modal-view ng-controller="ModalCtrl">
<ion-header-bar>
<h1 class="title">New Contact</h1>
<button class="button button-positive" ng-click="hideModal()">Close</button>
</ion-header-bar>
<ion-content>
<!--
<div class="padding">
<div class="list">
<label class="item item-input">
<span class="input-label">First Name</span>
<input type="text" placeholder="">
</label>
<label class="item item-input">
<span class="input-label">Last Name</span>
<input type="text" placeholder="">
</label>
<label class="item item-input">
<span class="input-label">Email</span>
<input type="text" placeholder="">
</label>
<button class="button button-block button-positive" ng-click="hideModal()">Hide Modal</button>
<button class="button button-block button-positive" ng-click="removeModal()">Remove Modal</button>
<button class="button button-block button-positive" ng-click="openActionSheet()">ActionSheet</button>
<button class="button button-block button-positive" ng-click="openPopup()">Popup</button>
</div>
</div>
-->
<ion-slides options="options" slider="data.slider">
<ion-slide-page>
<ion-content>
<h2>Journey to HD 219134 b</h2>
<p>
This app will prepare you for your journey through the galaxy
to HD 219134 b, an exoplanet 21 lightyears away from our home on Earth.
</p>
<p>
<img src="exoplanet.jpg" style="max-width: 100%" />
</p>
<div style="text-align: center">
<small style="font-style: italic">An artists rendering of your new home.</small>
</div>
<div>
<button class="button button-assertive" ng-click="doClick()">Tap</button>
</div>
</ion-content>
</ion-slide-page>
</ion-slides>
</ion-content>
</ion-modal-view>
</script>
<script>
angular.module('modalTest', ['ionic'])
.controller('AppCtrl', function($scope, $ionicModal) {
$scope.contacts = [
{ name: 'Gordon Freeman' },
{ name: 'Barney Calhoun' },
{ name: 'Lamarr the Headcrab' },
];
$scope.openModal = function() {
$scope.modal.show();
};
$ionicModal.fromTemplateUrl('modal.html', function(modal) {
$scope.modal = modal;
}, {
animation: 'slide-in-up',
focusFirstInput: true
});
})
.controller('ModalCtrl', function($scope, $ionicActionSheet, $ionicPopup) {
$scope.hideModal = function() {
$scope.modal.hide();
};
$scope.removeModal = function() {
$scope.modal.remove();
};
$scope.openActionSheet = function() {
$ionicActionSheet.show({
// The various non-destructive button choices
buttons: [
{ text: 'Share' },
{ text: 'Move' },
],
// The text of the red destructive button
destructiveText: 'Delete',
// The title text at the top
titleText: 'Modify your album',
// The text of the cancel button
cancelText: 'Cancel',
// Called when the sheet is cancelled, either from triggering the
// cancel button, or tapping the backdrop, or using escape on the keyboard
cancel: function() {
},
// Called when one of the non-destructive buttons is clicked, with
// the index of the button that was clicked. Return
// "true" to tell the action sheet to close. Return false to not close.
buttonClicked: function(index) {
return true;
},
// Called when the destructive button is clicked. Return true to close the
// action sheet. False to keep it open
destructiveButtonClicked: function() {
return true;
}
});
};
$scope.openPopup = function() {
$ionicPopup.alert({
title: 'Hey!',
content: 'Don\'t do that!'
}).then(function(res) {});
};
});
domTrace.observe();
</script>
</body>
</html>