How to dynamically change header based on AngularJS partial view?

后端 未结 22 2400
一向
一向 2020-11-22 10:53

I am using ng-view to include AngularJS partial views, and I want to update the page title and h1 header tags based on the included view. These are out of scope of the parti

22条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 11:30

    Simple and dirty way using $rootScope:

    
    
    Placeholder title
    

    In your controllers, when you have the data necessary to create the title, do:

    $rootScope.title = 'Page X'
    

提交回复
热议问题