Browse Source

footer current year; load user data on init

master
Robin Thoni 8 years ago
parent
commit
0bb1ccd56b
2 changed files with 20 additions and 2 deletions
  1. 19
    1
      app/app.js
  2. 1
    1
      app/views/footer.html

+ 19
- 1
app/app.js View File

@@ -16,10 +16,20 @@ var app = angular.module('app', [
16 16
 app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider',
17 17
     function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
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 28
         //$locationProvider.html5Mode(true);
20 29
 
21 30
         $stateProvider.state('login',{
22 31
             url:'/',
32
+            parent: 'root',
23 33
             templateUrl:'views/login.html',
24 34
             controller:'LoginController',
25 35
             resolve:{}
@@ -27,6 +37,7 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
27 37
 
28 38
         $stateProvider.state('home',{
29 39
             url:'/home',
40
+            parent: 'root',
30 41
             templateUrl:'views/home.html',
31 42
             controller:'HomeController',
32 43
             revolve:{}
@@ -52,8 +63,15 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
52 63
             }]);
53 64
 
54 65
     }])
66
+    .directive('dateNow', ['$filter', function($filter) {
67
+        return {
68
+            link: function( $scope, $element, $attrs) {
69
+                $element.text($filter('date')(new Date(), $attrs.dateNow));
70
+            }
71
+        };
72
+    }])
55 73
     .run(['$rootScope', '$state',function ($rootScope, $state) {
56 74
         $rootScope.$on('$stateChangeError', function (e, curr, prev) {
57
-            $state.go('login');
75
+            //$state.go('login');
58 76
         });
59 77
     }]);

+ 1
- 1
app/views/footer.html View File

@@ -8,7 +8,7 @@
8 8
     <footer>
9 9
         <div class="row">
10 10
             <div class="col-lg-12 text-center">
11
-                <p>Copyright &copy; App 2015</p>
11
+                <p>Copyright &copy; App <span date-now="yyyy"></span></p>
12 12
             </div>
13 13
         </div>
14 14
     </footer>

Loading…
Cancel
Save