1

I am trying to achive something like this:

$routeProvider.when("/home", angularAMD.route({
    title: 'Home',
    templateUrl: 'views/home.html',
    controller: 'testCtrl'
}))

Like in this post about $routeProvider How to dynamically change header based on angularjs partial view? (the second unacepted answer but seem to be better answer)

$routeProvider.when('/', {
  title: 'Home',
  templateUrl: '/Assets/Views/Home.html',
  controller: 'HomeController'
});
Community
  • 1
  • 1
Linh Pham
  • 2,905
  • 19
  • 31

1 Answers1

1

Add this code below the app.config()

  app.run(['$rootScope', '$route', function($rootScope, $route) {
        $rootScope.$on('$routeChangeSuccess', function() {
            document.title = $route.current.title;
        });
    }]);

And Layout View:

<!DOCTYPE html>
<html ng-app="app">
<head>
    <title>Default title</title>

No need to bind, no need to use {{}}.

VBMali
  • 1,302
  • 2
  • 16
  • 40
  • Thanks for the document title! – Linh Pham Jul 10 '15 at 07:04
  • @LinhPham: You Welcome! If it solves your issue , please mark the answer as "Accepted". – VBMali Jul 10 '15 at 07:11
  • @LinhPham: OffTopic: If possible try to look over the issue (not solved yet) : http://stackoverflow.com/questions/31288001/how-to-use-chart-js-with-angular-chart-using-requirejs – VBMali Jul 10 '15 at 07:19
  • Something messed with my mobile, it does solved issue in a way. Thanks again – Linh Pham Jul 10 '15 at 09:13
  • Ok. Please look over the question that I have mentioned in previous comment. I am having problem there, try to suggest something. – VBMali Jul 10 '15 at 09:23
  • I already added comment there. Check it out and provide some more info after applied what I suggest in the comment :) – Linh Pham Jul 10 '15 at 09:45
  • Yes. I am looking over it. Will try whatever you suggest...Thanks. – VBMali Jul 10 '15 at 12:26