-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.js
75 lines (70 loc) · 2.19 KB
/
routes.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
(function () {
'use strict';
angular
.module('ev')
.config(setUpRoutes)
;
function setUpRoutes($urlRouterProvider, $locationProvider, $stateProvider) {
$urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(false);
$stateProvider
.state('create', {
url: '/create',
templateUrl: 'action/form/action.form.html',
controller: 'ActionFormCtrl as actionFormVm',
})
.state('edit', {
url: '/edit/:id',
templateUrl: 'action/form/action.form.html',
controller: 'ActionFormCtrl as actionFormVm',
})
.state('index', {
url: '/',
templateUrl: 'action/index/action.index.html',
controller: 'IndexActionCtrl as indexActionVm',
})
.state('show', {
url: '/show/:id',
templateUrl: 'action/show/action.show.html',
controller: 'ShowActionCtrl as showActionVm',
})
.state('compare', {
url: '/compare',
templateUrl: 'compare/compare.html',
controller: 'CompareCtrl as compareVm',
params: {
actionIds: {
array: true,
},
},
resolve: {
actions: function ($stateParams, ActionService) {
var actions = [];
for (var i = 0, len = $stateParams.actionIds.length; i < len; i++) {
actions.push(ActionService.actions[$stateParams.actionIds[i]]);
}
return actions;
},
actionsInfoContainer: function ($stateParams) {
var actionsInfoContainer = [];
for (var i = 0, len = $stateParams.actionIds.length; i < len; i++) {
actionsInfoContainer.push({});
}
return actionsInfoContainer;
},
actionNames: function ($stateParams, ActionService) {
var actionNames = [];
for (var i = 0, len = $stateParams.actionIds.length; i < len; i++) {
actionNames.push(ActionService.actions[$stateParams.actionIds[i]].name);
}
return actionNames;
},
},
})
.state('about', {
url: '/about',
templateUrl: 'about/about.html',
})
;
}
})();