Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'feature/route_and_all_pages' into develop
  • Loading branch information
zhangsichu committed Aug 4, 2015
2 parents 5153711 + ee56300 commit c9b8a35
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 9 deletions.
11 changes: 3 additions & 8 deletions www/index.html
Expand Up @@ -20,15 +20,10 @@

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="ddApp">

<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content>
</ion-content>
</ion-pane>
<ion-nav-view></ion-nav-view>
</body>
</html>
41 changes: 40 additions & 1 deletion www/js/app.js
Expand Up @@ -3,7 +3,7 @@
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('ddApp', ['ionic'])
angular.module('ddApp', ['ionic', 'ddApp.services', 'ddApp.controllers'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
Expand All @@ -17,3 +17,42 @@ angular.module('ddApp', ['ionic'])
}
});
})
.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$stateProvider
.state(
'login', {
url: '/login',
templateUrl: 'templates/login.html',
controller: 'LoginCtrl'
})
.state(
'list', {
url: '/list',
templateUrl: 'templates/list.html',
controller: 'ListCtrl'
})
.state(
'scan', {
url: '/scan',
templateUrl: 'templates/scan.html',
controller: 'ScanCtrl'
})
.state(
'manual', {
url: '/manual',
templateUrl: 'templates/manual.html',
controller: 'ManualCtrl'
})
.state(
'detail', {
url: '/detail/:orderId',
templateUrl: 'templates/detail.html',
controller: 'DetailCtrl'
})

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/login');

$ionicConfigProvider.tabs.style('ios'); //even if you're on android
$ionicConfigProvider.tabs.position('ios'); //even if you're on android
});
38 changes: 38 additions & 0 deletions www/js/controllers.js
@@ -0,0 +1,38 @@
/**
* Created by sczhang on 8/4/15.
*/
angular.module('ddApp.controllers', ['ddApp.services'])
.controller('LoginCtrl', function ($scope, $state, $ionicPopup, $ionicHistory, $ionicViewSwitcher, $ionicLoading) {
$scope.doLogin = function() {
$state.go('list', {}, {reload: true});
}
})
.controller('ListCtrl', function ($scope, $state, $ionicPopup, $ionicHistory, $ionicViewSwitcher, $ionicLoading) {
$scope.goDetail = function() {
$state.go('detail', {}, {reload: true});
};
$scope.goScan = function() {
$state.go('scan');
};
$scope.goManual = function() {
$state.go('manual');
};
$scope.doExit = function(){
$state.go('login');
}
})
.controller('DetailCtrl', function ($scope, $state, $ionicPopup, $ionicHistory, $ionicViewSwitcher, $ionicLoading) {
$scope.goList = function() {
$state.go('list', {}, {reload: true});
}
})
.controller('ManualCtrl', function ($scope, $state, $ionicPopup, $ionicHistory, $ionicViewSwitcher, $ionicLoading) {
$scope.goDetail = function() {
$state.go('detail', {}, {reload: true});
};
})
.controller('ScanCtrl', function ($scope, $state, $ionicPopup, $ionicHistory, $ionicViewSwitcher, $ionicLoading) {
$scope.goDetail = function() {
$state.go('detail', {}, {reload: true});
};
})
5 changes: 5 additions & 0 deletions www/js/services.js
@@ -0,0 +1,5 @@
/**
* Created by sczhang on 8/4/15.
*/

angular.module('ddApp.services', []);
3 changes: 3 additions & 0 deletions www/templates/detail.html
@@ -0,0 +1,3 @@
<h1>Detail</h1>

<button ng-click="goList();">返回列表</button>
11 changes: 11 additions & 0 deletions www/templates/list.html
@@ -0,0 +1,11 @@
<h1>List</h1>

<button ng-click="goDetail();">进入一个订单</button>

<button ng-click="goScan();">扫描一个订单</button>

<button ng-click="goManual();">手动输入</button>

<p>
<button ng-click="doExit();">退出系统</button>
</p>
3 changes: 3 additions & 0 deletions www/templates/login.html
@@ -0,0 +1,3 @@
<h1>Login</h1>

<button ng-click="doLogin();">登陆</button>
3 changes: 3 additions & 0 deletions www/templates/manual.html
@@ -0,0 +1,3 @@
<h1>Manual</h1>

<button ng-click="goDetail();">输入成功进入一个订单</button>
3 changes: 3 additions & 0 deletions www/templates/scan.html
@@ -0,0 +1,3 @@
<h1>Scan</h1>

<button ng-click="goDetail();">扫描成功进入一个订单</button>

0 comments on commit c9b8a35

Please sign in to comment.