-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
104 lines (87 loc) · 2.37 KB
/
index.html
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
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height">
<script src="ionic/js/ionic.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="ionic/css/ionic.min.css">
<meta charset="utf-8">
</head>
<body ng-controller="main">
<!-- <ion-header-bar class="bar-positive">
<h1 class="title">ion-tabs</h1>
</ion-header-bar> -->
<!-- //载入模板的容器 -->
<ion-nav-view></ion-nav-view>
<!-- <ion-tabs></ion-tabs> -->
<script>
var m1 = angular.module("myApp",["ionic"]);
m1.config(['$stateProvider',"$urlRouterProvider",function($stateProvider,$urlRouterProvider) {
//tabs 是父状态
//子状态声明 父状态.子状态名字
$stateProvider.state("tabs",{
url:"/tabs",
// abstract:true,
templateUrl:"template/tabs.html"
}).state("tabs.tab1",{
url:"/tab1",
views:{
"myTab1":{
templateUrl:"template/tab1.html",
controller:"tab1Ctrl"
}
}
}).state("tabs.tab2",{
url:"/tab2",
views:{
"myTab2":{
templateUrl:"template/tab2.html"
}
}
}).state("tabs.tab3",{
url:"/tab3",
views:{
"myTab3":{
templateUrl:"template/tab3.html"
}
}
}).state("tabs.tab2Detail",{
url:"/tab2Detail/:kerwinData",
views:{
"myTab2":{
templateUrl:"template/tab2Detail.html",
controller:"tab2DetailCtrl"
}
}
}).state("starter",{
url:"/starter",
templateUrl:"template/starter.html"
})
// if(localStorage.getItem("first")){
// $urlRouterProvider.otherwise("/tabs/tab1");
// }else{
$urlRouterProvider.otherwise("/starter");
// localStorage.setItem("first",true);
// }
}])
m1.controller('main', ['$scope',"$state","$ionicSideMenuDelegate", function($scope,$state,$ionicSideMenuDelegate){
//如果是一个子状态 ,父状态会默认先被加载
$state.go("tabs.tab2");
$scope.closeSideMenu = function(){
$ionicSideMenuDelegate.toggleLeft();
}
}])
m1.controller('tab2DetailCtrl', ['$scope',"$stateParams", function($scope,$stateParams){
console.log($stateParams);
$scope.myparam =$stateParams.kerwinData;
// {"kerwinData":*****}
}])
m1.controller('tab1Ctrl', ['$scope', function($scope){
$scope.doDragRight = function(ev){
// console.log(ev);
//阻止冒泡
ev.stopPropagation();
}
}])
</script>
</body>
</html>