Browse Source

moved load groups to app.js

tags/1.0.0
Robin Thoni 8 years ago
parent
commit
6ef1139f0a
2 changed files with 22 additions and 22 deletions
  1. 20
    4
      app/app.js
  2. 2
    18
      app/controllers/sidebar.controller.js

+ 20
- 4
app/app.js View File

@@ -34,8 +34,24 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
34 34
             }
35 35
         };
36 36
     }])
37
-    .run(['$rootScope', '$state',function ($rootScope, $state) {
38
-        $rootScope.$on('$stateChangeError', function (e, curr, prev) {
39
-            //$state.go('/');
40
-        });
37
+    .run(['$rootScope', '$state', '$location', 'DataShareBusiness', 'GroupsBusiness',
38
+        function ($rootScope, $state, $location, DataShareBusiness, GroupsBusiness) {
39
+            $rootScope.$on('$stateChangeError', function (e, curr, prev) {
40
+                //$state.go('/');
41
+            });
42
+
43
+            $rootScope.$watch(function(){ return Object.keys($location.search())[0] }, function(){
44
+                if (DataShareBusiness.Groups != null) {
45
+                    DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
46
+                }
47
+            });
48
+
49
+            var promiseLoadGroups = {
50
+                id: "promiseLoadGroups",
51
+                loaderGroups: ["sidebar", "toolbar"]
52
+            };
53
+            GroupsBusiness.loadAll(promiseLoadGroups).then(function(data)
54
+            {
55
+                DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
56
+            });
41 57
     }]);

+ 2
- 18
app/controllers/sidebar.controller.js View File

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 5
 angular.module('app')
6
-    .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness', 'GroupsBusiness', '$location',
7
-        function($scope, $state, DataShareBusiness, GroupsBusiness, $location) {
6
+    .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness',
7
+        function($scope, $state, DataShareBusiness) {
8 8
 
9 9
             $scope.DataShareBusiness = DataShareBusiness;
10 10
 
@@ -19,20 +19,4 @@ angular.module('app')
19 19
                 }
20 20
                 return DataShareBusiness.Groups;
21 21
             };
22
-
23
-            $scope.$watch(function(){ return Object.keys($location.search())[0] }, function(){
24
-                if (DataShareBusiness.Groups != null) {
25
-                    DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
26
-                }
27
-            });
28
-
29
-            var promiseLoadGroups = {
30
-                id: "promiseLoadGroups",
31
-                loaderGroups: ["sidebar", "toolbar"]
32
-            };
33
-            GroupsBusiness.loadAll(promiseLoadGroups).then(function(data)
34
-            {
35
-                $scope.groups = data;
36
-                DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
37
-            });
38 22
         }]);

Loading…
Cancel
Save