Skip to content

Commit fb4dafd

Browse files
author
Adam Bradley
committed
update for nav-view testing
1 parent 5932dbc commit fb4dafd

File tree

2 files changed

+217
-10
lines changed

2 files changed

+217
-10
lines changed

js/ext/angular/test/sideMenu2.html

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
<html ng-app="ionicApp">
2+
<head>
3+
<meta charset="utf-8">
4+
<title>Side Menus</title>
5+
6+
<!-- Sets initial viewport load and disables zooming -->
7+
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
8+
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
9+
<script src="../../../../dist/js/ionic.js"></script>
10+
<script src="../../../../dist/js/angular/angular.js"></script>
11+
<script src="../../../../dist/js/angular/angular-animate.js"></script>
12+
<script src="../../../../dist/js/angular/angular-sanitize.js"></script>
13+
<script src="../../../../dist/js/angular-ui/angular-ui-router.js"></script>
14+
<script src="../../../../dist/js/ionic-angular.js"></script>
15+
</head>
16+
<body>
17+
18+
<div ng-controller="MainCtrl">
19+
<nav-view></nav-view>
20+
</div>
21+
22+
<script id="event-menu.html" type="text/ng-template">
23+
<side-menus>
24+
25+
<pane side-menu-content>
26+
<nav-bar type="bar-positive"
27+
back-button-type="button-icon"
28+
back-button-icon="ion-ios7-arrow-back"></nav-bar>
29+
<nav-view name="menuContent"></nav-view>
30+
</pane>
31+
32+
<side-menu side="left">
33+
<header class="bar bar-header bar-assertive">
34+
<div class="title">Left Menu</div>
35+
</header>
36+
<content has-header="true">
37+
<ul class="list">
38+
<a href="#/event/check-in" class="item">Check-in</a>
39+
<a href="#/event/attendees" class="item">Attendees</a>
40+
</ul>
41+
</content>
42+
</side-menu>
43+
44+
</side-menus>
45+
</script>
46+
47+
<script id="home.html" type="text/ng-template">
48+
<view title="'Welcome'">
49+
<content has-header="true" padding="true">
50+
<p>Swipe to the right to reveal the left menu.</p>
51+
<p>(On desktop click and drag from left to right)</p>
52+
</content>
53+
</view>
54+
</script>
55+
56+
<script id="check-in.html" type="text/ng-template">
57+
<view title="'Event Check-in'">
58+
<content has-header="true">
59+
<form class="list" ng-show="showForm">
60+
<div class="item item-divider">
61+
Attendee Info
62+
</div>
63+
<label class="item item-input">
64+
<input type="text" placeholder="First Name" ng-model="attendee.firstname">
65+
</label>
66+
<label class="item item-input">
67+
<input type="text" placeholder="Last Name" ng-model="attendee.lastname">
68+
</label>
69+
<div class="item item-divider">
70+
Shirt Size
71+
</div>
72+
<radio ng-repeat="shirtSize in shirtSizes"
73+
ng-value="shirtSize.value"
74+
ng-model="attendee.shirtSize">
75+
{{ shirtSize.text }}
76+
</radio>
77+
<div class="item item-divider">
78+
Lunch
79+
</div>
80+
<toggle ng-model="attendee.vegetarian">
81+
Vegetarian
82+
</toggle>
83+
<div class="padding">
84+
<button class="button button-block" ng-click="submit()">Checkin</button>
85+
</div>
86+
</form>
87+
88+
<div ng-hide="showForm">
89+
<pre ng-bind="attendee | json"></pre>
90+
<a href="#/event/attendees">View attendees</a>
91+
</div>
92+
</content>
93+
</view>
94+
</script>
95+
96+
<script id="attendees.html" type="text/ng-template">
97+
<view title="'Event Attendees'">
98+
<content has-header="true">
99+
<div class="list">
100+
<toggle ng-repeat="attendee in attendees | orderBy:'firstname' | orderBy:'lastname'"
101+
ng-model="attendee.arrived"
102+
ng-change="arrivedChange(attendee)">
103+
{{ attendee.firstname }}
104+
{{ attendee.lastname }}
105+
</toggle>
106+
<div class="item item-divider">
107+
Activity
108+
</div>
109+
<div class="item" ng-repeat="msg in activity">
110+
{{ msg }}
111+
</div>
112+
</div>
113+
</content>
114+
</view>
115+
</script>
116+
117+
<script>
118+
angular.module('ionicApp', ['ionic'])
119+
120+
.config(function($stateProvider, $urlRouterProvider) {
121+
122+
$stateProvider
123+
.state('eventmenu', {
124+
url: "/event",
125+
abstract: true,
126+
templateUrl: "event-menu.html"
127+
})
128+
.state('eventmenu.home', {
129+
url: "/home",
130+
views: {
131+
'menuContent' :{
132+
templateUrl: "home.html"
133+
}
134+
}
135+
})
136+
.state('eventmenu.checkin', {
137+
url: "/check-in",
138+
views: {
139+
'menuContent' :{
140+
templateUrl: "check-in.html",
141+
controller: "CheckinCtrl"
142+
}
143+
}
144+
})
145+
.state('eventmenu.attendees', {
146+
url: "/attendees",
147+
views: {
148+
'menuContent' :{
149+
templateUrl: "attendees.html",
150+
controller: "AttendeesCtrl"
151+
}
152+
}
153+
})
154+
155+
$urlRouterProvider.otherwise("/event/home");
156+
})
157+
158+
.controller('MainCtrl', function($scope) {
159+
console.log('MainCtrl');
160+
161+
$scope.attendees = [
162+
{ firstname: 'Nicolas', lastname: 'Cage' },
163+
{ firstname: 'Jean-Claude', lastname: 'Van Damme' },
164+
{ firstname: 'Keanu', lastname: 'Reeves' },
165+
{ firstname: 'Steven', lastname: 'Seagal' },
166+
{ firstname: 'Jeff', lastname: 'Goldblum' },
167+
{ firstname: 'Brendan', lastname: 'Fraser' }
168+
];
169+
})
170+
171+
.controller('CheckinCtrl', function($scope) {
172+
$scope.showForm = true;
173+
174+
$scope.shirtSizes = [
175+
{ text: 'Large', value: 'L' },
176+
{ text: 'Medium', value: 'M' },
177+
{ text: 'Small', value: 'S' }
178+
];
179+
180+
$scope.attendee = {};
181+
$scope.submit = function() {
182+
if(!$scope.attendee.firstname) {
183+
alert('Info required');
184+
return;
185+
}
186+
$scope.showForm = false;
187+
$scope.attendees.push($scope.attendee);
188+
};
189+
190+
})
191+
192+
.controller('AttendeesCtrl', function($scope) {
193+
194+
$scope.activity = [];
195+
$scope.arrivedChange = function(attendee) {
196+
var msg = attendee.firstname + ' ' + attendee.lastname;
197+
msg += (!attendee.arrived ? ' has arrived, ' : ' just left, ');
198+
msg += new Date().getMilliseconds();
199+
$scope.activity.push(msg);
200+
if($scope.activity.length > 3) {
201+
$scope.activity.splice(0, 1);
202+
}
203+
};
204+
205+
});
206+
</script>
207+
</body>
208+
</html>
209+

js/ext/angular/test/viewState.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
<script src="../../../../dist/js/ionic.js"></script>
1010
<script src="../../../../dist/js/angular/angular.js"></script>
1111
<script src="../../../../dist/js/angular/angular-animate.js"></script>
12-
<script src="../../../../dist/js/angular/angular-route.js"></script>
13-
<script src="../../../../dist/js/angular/angular-touch.js"></script>
1412
<script src="../../../../dist/js/angular/angular-sanitize.js"></script>
1513
<script src="../../../../dist/js/angular-ui/angular-ui-router.js"></script>
1614
<script src="../../../../dist/js/ionic-angular.js"></script>
@@ -27,7 +25,7 @@
2725
</div>
2826

2927
<script id="sign-in.html" type="text/ng-template">
30-
<view title="'<u>Sign-In</u>'" left-buttons="leftButtons" right-buttons="rightButtons">
28+
<view title="'Sign-In'" left-buttons="leftButtons" right-buttons="rightButtons">
3129
<content has-header="true">
3230
<div class="list">
3331
<label class="item item-input">
@@ -108,15 +106,15 @@
108106
<tabs tabs-style="tabs-icon-top" tabs-type="tabs-positive">
109107

110108
<tab title="Automobiles" icon="ion-model-s" href="#/tabs/autos">
111-
<nav-view name="auto-ui-view"></nav-view>
109+
<nav-view name="auto-nav-view"></nav-view>
112110
</tab>
113111

114112
<tab title="Add" icon="ion-plus-circled" href="#/tabs/add-auto">
115-
<nav-view name="add-autos-ui-view"></nav-view>
113+
<nav-view name="add-autos-nav-view"></nav-view>
116114
</tab>
117115

118116
<tab title="About" icon="ion-ios7-world" ui-sref="tabs.about">
119-
<nav-view name="about-ui-view"></nav-view>
117+
<nav-view name="about-nav-view"></nav-view>
120118
</tab>
121119

122120
<tab title="Info" icon="ion-information-circled">
@@ -271,7 +269,7 @@ <h3>About this app!</h3>
271269
.state('tabs.autolist', {
272270
url: "/autos",
273271
views: {
274-
'auto-ui-view': {
272+
'auto-nav-view': {
275273
templateUrl: "auto-list.html",
276274
controller: 'AutoListCtrl'
277275
}
@@ -280,7 +278,7 @@ <h3>About this app!</h3>
280278
.state('tabs.addauto', {
281279
url: "/add-auto",
282280
views: {
283-
'add-autos-ui-view': {
281+
'add-autos-nav-view': {
284282
templateUrl: "add-auto.html",
285283
controller: 'AutoAddCtrl'
286284
}
@@ -289,7 +287,7 @@ <h3>About this app!</h3>
289287
.state('tabs.autodetail', {
290288
url: "/autos/:id",
291289
views: {
292-
'auto-ui-view': {
290+
'auto-nav-view': {
293291
templateUrl: "auto-detail.html",
294292
controller: 'AutoDetailCtrl'
295293
}
@@ -298,7 +296,7 @@ <h3>About this app!</h3>
298296
.state('tabs.about', {
299297
url: "/about",
300298
views: {
301-
'about-ui-view': {
299+
'about-nav-view': {
302300
templateUrl: "about.html"
303301
}
304302
}

0 commit comments

Comments
 (0)