質問編集履歴
1
index.htmlを掲載した。
title
CHANGED
File without changes
|
body
CHANGED
@@ -82,4 +82,148 @@
|
|
82
82
|
- 2つめの問題は、現状では`<ons-list-item ng-click="lstc.output('1')" modifier="tappable">リストを押した</ons-list-item>`をクリックすると一瞬だけbuttonと表示されダイアログが消えてしまいます。
|
83
83
|
|
84
84
|
|
85
|
-
どうかご回答の程よろしくお願いいたします。
|
85
|
+
どうかご回答の程よろしくお願いいたします。
|
86
|
+
|
87
|
+
index.htmlが必要とのことなので載せておきます。よろしくお願いいたします。
|
88
|
+
```html
|
89
|
+
<!DOCTYPE HTML>
|
90
|
+
<html>
|
91
|
+
<head>
|
92
|
+
<meta charset="utf-8">
|
93
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
94
|
+
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
|
95
|
+
<script src="components/loader.js"></script>
|
96
|
+
<script src="lib/angular/angular.min.js"></script>
|
97
|
+
<script src="lib/onsenui/js/onsenui.min.js"></script>
|
98
|
+
<script src="lib/onsenui/js/angular-onsenui.min.js"></script>
|
99
|
+
|
100
|
+
<link rel="stylesheet" href="components/loader.css">
|
101
|
+
<link rel="stylesheet" href="lib/onsenui/css/onsenui.css">
|
102
|
+
<link rel="stylesheet" href="lib/onsenui/css/onsen-css-components.css">
|
103
|
+
<link rel="stylesheet" href="css/style.css">
|
104
|
+
|
105
|
+
<script>
|
106
|
+
ons.bootstrap()
|
107
|
+
//左上のページを変える処理
|
108
|
+
.controller('AppController', function($scope) {
|
109
|
+
this.load = function(page) {
|
110
|
+
$scope.splitter.content.load(page);
|
111
|
+
$scope.splitter.left.close();
|
112
|
+
};
|
113
|
+
this.toggle = function() {
|
114
|
+
$scope.splitter.left.toggle();
|
115
|
+
};
|
116
|
+
})
|
117
|
+
//ダイアログを開く処理
|
118
|
+
.controller('DialogController', function($scope) {
|
119
|
+
this.button="button";
|
120
|
+
this.show = function(dlg) {
|
121
|
+
ons.createDialog(dlg).then(function(dialog) {
|
122
|
+
dialog.show();
|
123
|
+
});
|
124
|
+
}
|
125
|
+
})
|
126
|
+
//リストを選んだときの処理
|
127
|
+
.controller('listController', function($scope) {
|
128
|
+
this.output = function(key){
|
129
|
+
dialog.hide();
|
130
|
+
keyword=key;
|
131
|
+
console.log(keyword);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
ons.ready(function() {
|
135
|
+
console.log("Onsen UI is ready!");
|
136
|
+
});
|
137
|
+
</script>
|
138
|
+
</head>
|
139
|
+
<body>
|
140
|
+
|
141
|
+
<ons-splitter ng-controller="AppController as app" var="splitter">
|
142
|
+
<ons-splitter-side side="left" width="220px" collapse swipeable>
|
143
|
+
<ons-page>
|
144
|
+
<ons-list>
|
145
|
+
<ons-list-item ng-click="app.load('home.html')" tappable>
|
146
|
+
Home
|
147
|
+
</ons-list-item>
|
148
|
+
<ons-list-item ng-click="app.load('settings.html')" tappable>
|
149
|
+
Settings
|
150
|
+
</ons-list-item>
|
151
|
+
<ons-list-item ng-click="app.load('about.html')" tappable>
|
152
|
+
About
|
153
|
+
</ons-list-item>
|
154
|
+
</ons-list>
|
155
|
+
</ons-page>
|
156
|
+
</ons-splitter-side>
|
157
|
+
<ons-splitter-content page="home.html"></ons-splitter-content>
|
158
|
+
</ons-splitter>
|
159
|
+
|
160
|
+
<ons-template id="home.html">
|
161
|
+
<ons-page>
|
162
|
+
<ons-toolbar>
|
163
|
+
<div class="left">
|
164
|
+
<ons-toolbar-button ng-click="app.toggle()">
|
165
|
+
<ons-icon icon="md-menu"></ons-icon>
|
166
|
+
</ons-toolbar-button>
|
167
|
+
</div>
|
168
|
+
<div class="center">
|
169
|
+
Main
|
170
|
+
</div>
|
171
|
+
</ons-toolbar>
|
172
|
+
<div ng-controller="DialogController as dlgc">
|
173
|
+
<ons-button ng-click="dlgc.show('button.html')" id="btn1">button1</ons-button>
|
174
|
+
</div>
|
175
|
+
</ons-page>
|
176
|
+
</ons-template>
|
177
|
+
|
178
|
+
<ons-template id="settings.html">
|
179
|
+
<ons-page>
|
180
|
+
<ons-toolbar>
|
181
|
+
<div class="left">
|
182
|
+
<ons-toolbar-button ng-click="app.toggle()">
|
183
|
+
<ons-icon icon="md-menu"></ons-icon>
|
184
|
+
</ons-toolbar-button>
|
185
|
+
</div>
|
186
|
+
<div class="center">
|
187
|
+
Settings
|
188
|
+
</div>
|
189
|
+
</ons-toolbar>
|
190
|
+
</ons-page>
|
191
|
+
</ons-template>
|
192
|
+
|
193
|
+
<ons-template id="about.html">
|
194
|
+
<ons-page>
|
195
|
+
<ons-toolbar>
|
196
|
+
<div class="left">
|
197
|
+
<ons-toolbar-button ng-click="app.toggle()">
|
198
|
+
<ons-icon icon="md-menu"></ons-icon>
|
199
|
+
</ons-toolbar-button>
|
200
|
+
</div>
|
201
|
+
<div class="center">
|
202
|
+
About
|
203
|
+
</div>
|
204
|
+
</ons-toolbar>
|
205
|
+
</ons-page>
|
206
|
+
</ons-template>
|
207
|
+
|
208
|
+
<ons-template id="button.html">
|
209
|
+
<ons-dialog var="dialog" modifier="material" cancelable>
|
210
|
+
<div class="dialog-container" style="height: 200px;">
|
211
|
+
<ons-page>
|
212
|
+
<ons-toolbar>
|
213
|
+
<div class="center">
|
214
|
+
<div ng-controller="DialogController as dlgc" ng-cloak>
|
215
|
+
<span ng-bind="dlgc.button"></span>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
</ons-toolbar>
|
219
|
+
<ons-list ng-controller="listController as lstc">
|
220
|
+
<ons-list-item ng-click="lstc.output('1')" modifier="tappable">
|
221
|
+
リストを押した
|
222
|
+
</ons-list-item>
|
223
|
+
</ons-list>
|
224
|
+
</ons-page>
|
225
|
+
</div>
|
226
|
+
</ons-dialog>
|
227
|
+
</body>
|
228
|
+
</html>
|
229
|
+
```
|