我試圖根據當前視圖更改頁眉。標題在ngView之外。這是可能的還是我需要把頭部放在視圖中?在AngularJS中,我可以使用ngSwitch之外的當前路由ngView
我的代碼看起來與此類似:
<div id="header">
<div ng-switch on="pagename">
<div ng-switch-when="home">Welcome!</div>
<div ng-switch-when="product-list">Our products</div>
<div ng-switch-when="contact">Contact us</div>
</div>
(a lot of unrelated code goes here)
</div>
<div id="content>
<div ng-view></div>
</div>