Browse Source

page title

master
Robin Thoni 8 years ago
parent
commit
db87f802e6
2 changed files with 7 additions and 2 deletions
  1. 6
    1
      app/app.js
  2. 1
    1
      app/index.html

+ 6
- 1
app/app.js View File

@@ -30,6 +30,7 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
30 30
         $stateProvider.state('login',{
31 31
             url:'/',
32 32
             parent: 'root',
33
+            title: "Login",
33 34
             templateUrl:'views/login.html',
34 35
             controller:'LoginController',
35 36
             resolve:{}
@@ -38,6 +39,7 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
38 39
         $stateProvider.state('home',{
39 40
             url:'/home',
40 41
             parent: 'root',
42
+            title: "Home",
41 43
             templateUrl:'views/home.html',
42 44
             controller:'HomeController',
43 45
             revolve:{}
@@ -65,12 +67,15 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
65 67
     }])
66 68
     .directive('dateNow', ['$filter', function($filter) {
67 69
         return {
68
-            link: function( $scope, $element, $attrs) {
70
+            link: function($scope, $element, $attrs) {
69 71
                 $element.text($filter('date')(new Date(), $attrs.dateNow));
70 72
             }
71 73
         };
72 74
     }])
73 75
     .run(['$rootScope', '$state',function ($rootScope, $state) {
76
+        $rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
77
+            $rootScope.title = current.title + " - App";
78
+        });
74 79
         $rootScope.$on('$stateChangeError', function (e, curr, prev) {
75 80
             //$state.go('login');
76 81
         });

+ 1
- 1
app/index.html View File

@@ -3,7 +3,7 @@
3 3
 <head>
4 4
     <base href="/app/">
5 5
     <meta charset="utf-8">
6
-    <title>App</title>
6
+    <title ng-bind="title">App</title>
7 7
 
8 8
     <!-- build:css css/globals.css -->
9 9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">

Loading…
Cancel
Save