-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
74 lines (61 loc) · 1.93 KB
/
index.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
/**
* Created by ved on 27/8/16.
*/
var app = angular.module('rental',['ui.router','tmh.dynamicLocale','ngTable','toastr','ngTableToCsv','ngCookies','ngSanitize','ui.select','pascalprecht.translate']);
app.run(function ($state,$rootScope) {
$state.go('login');
$rootScope.title= "Car Rental"
});
app.run(['$rootScope', '$state', 'Auth', function ($rootScope, $state, Auth) {
$rootScope.$on('$stateChangeSuccess', function () {
if (!Auth.isLoggedIn()) {
$state.go('login');
}
else {
}
});
}]);
app.config(function(toastrConfig) {
angular.extend(toastrConfig, {
positionClass: 'toast-top-right',
preventDuplicates: true
});
});
app.constant('DEBUG_MODE', /*DEBUG_MODE*/true/*DEBUG_MODE*/);
app.constant('LOCALES', {
'locales': {
'en_US': 'English',
'es_ES': 'Spanish'
},
'preferredLocale': 'en_US'
});
// Angular debug info
app.config(function ($compileProvider, DEBUG_MODE) {
if (!DEBUG_MODE) {
$compileProvider.debugInfoEnabled(false);// disables AngularJS debug info
}
});
app.config(function ($translateProvider, DEBUG_MODE, LOCALES) {
if (DEBUG_MODE) {
$translateProvider.useMissingTranslationHandlerLog();// warns about missing translates
}
$translateProvider.useStaticFilesLoader({
prefix: 'resources/locale-',
suffix: '.json'
});
$translateProvider.preferredLanguage(LOCALES.preferredLocale);
$translateProvider.useLocalStorage();
});
app.config(function ($stateProvider, $urlRouterProvider){
$stateProvider
.state('login',{
url : '/login',
templateUrl : 'views/login.html',
controller : 'loginCtrl'
});
$urlRouterProvider.otherwise('/');
});
// Angular Dynamic Locale
app.config(function (tmhDynamicLocaleProvider) {
tmhDynamicLocaleProvider.localeLocationPattern('js/angular-i18n/angular-locale_{{locale}}.js');
});