-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
54 lines (46 loc) · 1.52 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
/**
* Created by mpereira on 7/30/2014.
*/
var app = angular.module('app', [
'ngAnimate',
'ui.router',
'ui.bootstrap',
'pascalprecht.translate',
'ngSanitize',
'appControllers',
//logical modules:
'module1' //,
//reusable components:
//'component1'
]);
app.config(['$httpProvider', '$stateProvider', '$urlRouterProvider', '$translateProvider', '$injector', function ($httpProvider, $stateProvider, $urlRouterProvider, $translateProvider, $injector) {
//mpereira: Activate CORS
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
//mpereira: State based navigation, with nested views from ui-router
$stateProvider
.state('a.state1', {
url: '/module1',
templateUrl: 'module1/module1.html'
})
.state('a.state2', {
url: '/module1',
templateUrl: 'module2/module2.html'
})
.state('error', {
url: '/error',
templateUrl: 'error.html'
})
;
//mpereira: default navigation
$urlRouterProvider.when('', '/module1').when('/', '/module1');
//mpereira: translation
$translateProvider.useStaticFilesLoader({
prefix: 'common/translation/locale-',
suffix: '.json'
});
$translateProvider.preferredLanguage('en_US');
}])
.run(['$rootScope', '$http', '$location', '$state', function ($rootScope, $http, $location, $state) {
// mpereira: put init code here, like security interceptors etc
}]);