How to dynamically change header based on AngularJS partial view?

后端 未结 22 1962
一向
一向 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:33

    Note that you can also set the title directly with javascript, i.e.,

    $window.document.title = someTitleYouCreated;
    

    This does not have data binding, but it suffices when putting ng-app in the tag is problematic. (For example, using JSP templates where is defined in exactly one place, yet you have more than one app.)

提交回复
热议问题