This repository was archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathapp.js
143 lines (118 loc) · 3.83 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
'use strict';
/*
Copyright (c) 2016, Oracle and/or its affiliates.
All rights reserved.
*/
// Declare app level module which depends on views, and components
angular.module('dinoDateApp', [
'ui.router',
'ngResource',
'ngSanitize',
'ngMessages'
]
)
.config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
$stateProvider.state('home', {
url: '/',
templateUrl: 'components/home/home.html'
});
$stateProvider.state('registration', {
url: '/register',
templateUrl: 'components/registration/registration.html',
controller: 'RegistrationCtrl as RegistrationCtrl',
resolve: {
'species': function($http) {
return $http.get('/api/v1/dinosaurs/species')
.then(function(results) {
return results.data.items;
});
},
'locations': function($http) {
return $http.get('/api/v1/locations')
.then(function(results) {
return results.data.items;
});
}
}
});
$stateProvider.state('controlPanel', {
url: '/admin/controlPanel',
templateUrl: 'components/admin/panel.html',
controller: 'PanelCtrl as PanelCtrl'
});
$stateProvider.state('login', {
url: '/login',
templateUrl: 'components/login/login.html',
controller: 'LoginCtrl as LoginCtrl'
});
$stateProvider.state('logout', {
url: '/logout',
controller: 'LogoutCtrl as LogoutCtrl'
});
$stateProvider.state('sessionExpired', {
url: '/sessionExpired',
controller: 'SessionExpiredCtrl as SessionExpiredCtrl'
});
$stateProvider.state('memberHome', {
url: '/home',
templateUrl: 'components/member-home/member-home.html',
controller: 'MemberHomeCtrl as MemberHomeCtrl'
});
$stateProvider.state('inbox', {
url: '/inbox',
templateUrl: 'components/inbox/inbox.html',
controller: 'InboxCtrl as InboxCtrl'
});
$stateProvider.state('message', {
url: '/inbox/:messageId',
templateUrl: 'components/inbox/message.html',
controller: 'InboxCtrl as InboxCtrl'
});
$stateProvider.state('compose', {
url: '/compose/:toMemberId',
templateUrl: 'components/inbox/compose.html',
controller: 'InboxCtrl as InboxCtrl'
});
$stateProvider.state('broadcast', {
url: '/broadcast',
templateUrl: 'components/inbox/compose.html',
controller: 'InboxCtrl as InboxCtrl'
});
$stateProvider.state('search', {
url: '/search',
templateUrl: 'components/search/search.html',
controller: 'SearchCtrl as SearchCtrl'
});
$stateProvider.state('selfProfile', {
url: '/profile',
templateUrl: 'components/profile/profile.html',
controller: 'ProfileCtrl as ProfileCtrl'
});
$stateProvider.state('profile', {
url: '/profile/:memberId',
templateUrl: 'components/profile/profile.html',
controller: 'ProfileCtrl as ProfileCtrl'
});
$stateProvider.state('about', {
url: '/about',
templateUrl: 'components/about/about.html',
controller: 'AboutCtrl as AboutCtrl'
});
$urlRouterProvider.otherwise('/');
$httpProvider.interceptors.push('authInterceptor');
$httpProvider.interceptors.push('oracleInfoInterceptor');
})
.controller('AppCtrl', function ($scope, currentUser) {
})
.controller('LogoutCtrl', function (currentUser, $state, alert) {
currentUser.clear();
alert('success', 'Logout Successful', 'Come back again soon!');
$state.go('home');
})
.controller('SessionExpiredCtrl', function (currentUser, $state, alert) {
currentUser.clear();
alert('error', 'Session Expired', 'You must login again.');
$state.go('login');
})
.constant('API_URL', '/api/v1/')
;