-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathapp.js
123 lines (103 loc) · 3.19 KB
/
app.js
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
// Ionic Starter App
// 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('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('tabs', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('tabs.home', {
url: '/home',
views: {
'home-tab' : {
templateUrl: 'templates/home.html'
}
}
})
.state('tabs.list', {
url: '/list',
views: {
'list-tab' : {
templateUrl: 'templates/list.html',
controller: 'ListController'
}
}
})
.state('tabs.detail', {
url: '/list/:aId',
views: {
'list-tab' : {
templateUrl: 'templates/detail.html',
controller: 'ListController'
}
}
})
.state('tabs.calendar', {
url: '/calendar',
views: {
'calendar-tab' : {
templateUrl: 'templates/calendar.html',
controller: 'CalendarController'
}
}
})
$urlRouterProvider.otherwise('/tab/home');
})
.controller('CalendarController', ['$scope', '$http', '$state',
function($scope, $http, $state) {
$http.get('js/data.json').success(function(data) {
$scope.calendar = data.calendar;
$scope.onItemDelete = function(dayIndex, item) {
$scope.calendar[dayIndex].schedule.splice($scope.calendar[dayIndex].schedule.indexOf(item), 1);
}
$scope.doRefresh =function() {
$http.get('js/data.json').success(function(data) {
$scope.calendar = data.calendar;
$scope.$broadcast('scroll.refreshComplete');
});
}
$scope.toggleStar = function(item) {
item.star = !item.star;
}
});
}])
.controller('ListController', ['$scope', '$http', '$state',
function($scope, $http, $state) {
$http.get('js/data.json').success(function(data) {
$scope.artists = data.artists;
$scope.whichartist=$state.params.aId;
$scope.data = { showDelete: false, showReorder: false };
$scope.onItemDelete = function(item) {
$scope.artists.splice($scope.artists.indexOf(item), 1);
}
$scope.doRefresh =function() {
$http.get('js/data.json').success(function(data) {
$scope.artists = data.artists;
$scope.$broadcast('scroll.refreshComplete');
});
}
$scope.toggleStar = function(item) {
item.star = !item.star;
}
$scope.moveItem = function(item, fromIndex, toIndex) {
$scope.artists.splice(fromIndex, 1);
$scope.artists.splice(toIndex, 0, item);
};
});
}]);