-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
103 lines (91 loc) · 2.13 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
// Angular app declaration, injecting modules and services
var ajapp = angular.module("ajjapp", ['ui.router', 'ngRoute', 'ngSanitize', 'UserService']);
ajapp.constant('myConfig',
{
baseURL: 'http://cortexapi.ddns.net:8080'
});
// Token interceptor
ajapp.config(function ($httpProvider) {
$httpProvider.interceptors.push('TokenInterceptor');
});
// Routes declaration
ajapp.config(function($stateProvider, $urlRouterProvider){
$stateProvider
.state('home',{
url:"/",
views: {
'@': {
templateUrl: "templates/home.html",
controller: 'homeCtrl',
access: { requiredLogin: false }
}
}
})
.state('login',{
url:"/login",
views: {
'@': {
templateUrl: "templates/users/login.html",
controller: 'userCtrl',
access: { requiredLogin: false }
}
}
})
.state('logout',{
url:"/logout",
views: {
'@': {
templateUrl: "templates/users/logout.html",
controller: 'userCtrl',
access: { requiredLogin: true }
}
}
})
.state('register',{
url:"/register",
views: {
'@': {
templateUrl: "templates/users/register.html",
controller: 'userCtrl',
access: { requiredLogin: false }
}
}
})
.state('theta',{
url:"/theta",
views: {
'@': {
templateUrl: "templates/theta.html",
controller: 'thetaCtrl',
access: { requiredLogin: false }
}
}
})
.state('appointment',{
url:"/appointment",
views: {
'@': {
templateUrl: "templates/appoint/appointment.html",
controller: 'appointCtrl',
access: { requiredLogin: false } // change to True
}
}
})
.state('modifyPerson',{
url:"/modifyPerson",
views: {
'@': {
templateUrl: "templates/users/modify.html",
controller: 'personCtrl',
access: { requiredLogin: false } // change to True
}
}
})
$urlRouterProvider.otherwise('/');
})
ajapp.run(function($rootScope, $state) {
$rootScope.$on("$stateChangeStart",
function(event, toState, toParams, fromState, fromParams) {
$state.callbackState = fromState.name
});
});