Browse Source

added loaduserdata as controller dependency

develop
Robin Thoni 8 years ago
parent
commit
7d65c7126a
1 changed files with 17 additions and 2 deletions
  1. 17
    2
      app.js

+ 17
- 2
app.js View File

16
 luticate.config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
16
 luticate.config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
17
     function($stateProvider, $urlRouterProvider, $httpProvider) {
17
     function($stateProvider, $urlRouterProvider, $httpProvider) {
18
 
18
 
19
+        $stateProvider.state('root', {
20
+            abstract: true,
21
+            template: '<div ui-view=""></div>',
22
+            resolve: ['luticateAuthUsers', function(luticateAuthUsers)
23
+            {
24
+                return luticateAuthUsers.loadUserData(null);
25
+            }]
26
+        });
27
+
19
         $stateProvider.state('login',{
28
         $stateProvider.state('login',{
20
             url:'/',
29
             url:'/',
30
+            parent: 'root',
21
             templateUrl:'views/login.html',
31
             templateUrl:'views/login.html',
22
             controller:'LoginController'
32
             controller:'LoginController'
23
         });
33
         });
24
 
34
 
25
         $stateProvider.state('home',{
35
         $stateProvider.state('home',{
26
             url:'/home',
36
             url:'/home',
37
+            parent: 'root',
27
             templateUrl:'views/home.html',
38
             templateUrl:'views/home.html',
28
             controller:'HomeController'
39
             controller:'HomeController'
29
         });
40
         });
30
 
41
 
31
         $stateProvider.state('users',{
42
         $stateProvider.state('users',{
32
             url:'/users',
43
             url:'/users',
44
+            parent: 'root',
33
             templateUrl:'views/users.html',
45
             templateUrl:'views/users.html',
34
             controller:'UsersController'
46
             controller:'UsersController'
35
         });
47
         });
36
 
48
 
37
         $stateProvider.state('groups',{
49
         $stateProvider.state('groups',{
38
             url:'/groups',
50
             url:'/groups',
51
+            parent: 'root',
39
             templateUrl:'views/groups.html',
52
             templateUrl:'views/groups.html',
40
             controller:'GroupsController'
53
             controller:'GroupsController'
41
         });
54
         });
42
 
55
 
43
         $stateProvider.state('permissions',{
56
         $stateProvider.state('permissions',{
44
             url:'/permissions',
57
             url:'/permissions',
58
+            parent: 'root',
45
             templateUrl:'views/permissions.html',
59
             templateUrl:'views/permissions.html',
46
             controller:'PermissionsController'
60
             controller:'PermissionsController'
47
         });
61
         });
48
 
62
 
49
         $stateProvider.state('settings',{
63
         $stateProvider.state('settings',{
50
             url:'/settings',
64
             url:'/settings',
65
+            parent: 'root',
51
             templateUrl:'views/settings.html',
66
             templateUrl:'views/settings.html',
52
             controller:'SettingsController'
67
             controller:'SettingsController'
53
         });
68
         });
54
 
69
 
55
         $stateProvider.state('test',{
70
         $stateProvider.state('test',{
56
             url:'/test',
71
             url:'/test',
72
+            parent: 'root',
57
             templateUrl:'views/test.html',
73
             templateUrl:'views/test.html',
58
             controller:'TestController'
74
             controller:'TestController'
59
         });
75
         });
83
 
99
 
84
     }])
100
     }])
85
     .run(['$rootScope', '$state', 'luticateAuthUsers',function ($rootScope, $state, luticateAuthUsers) {
101
     .run(['$rootScope', '$state', 'luticateAuthUsers',function ($rootScope, $state, luticateAuthUsers) {
86
-        luticateAuthUsers.loadPermissions(null);
87
         $rootScope.$on('$stateChangeError', function (e, curr, prev) {
102
         $rootScope.$on('$stateChangeError', function (e, curr, prev) {
88
-            $state.go('login');
103
+            //$state.go('login');
89
         });
104
         });
90
     }]);
105
     }]);

Loading…
Cancel
Save