4
我想將父視圖擴展到子視圖。角度ui路由器不擴展父視圖
我route.js
let view = {
'': {
templateUrl: '/app/content.html'
},
'sidebar': {
templateUrl: '/app/sidebar.html'
}
};
.state('profile', {
abstract: true,
url: '/profile',
views: view,
templateUrl: '/app/profile/profile.html'
})
.state('profile.about', {
parent: 'profile',
url: '/about',
views: {
'': {
templateUrl: '/app/profile/about.html'
}
}
})
我的index.html:
<div ui-view></div>
我的個人資料/ profile.html:
//all other stuff (header, sidebar, etc)
<div>
<h1>Profile</h1>
<div ui-view=""></div>
</div>
我的個人資料/ about.html:
<div>
<h1>About</h1>
</div>
一切工作完美,包括邊欄。
問題是about.html
顯示頁面,但它不擴展profile/profile.html
頁面。
任何解決方案?
這是plunker。
這是有點不同,但它是相同的,考慮如何route1
沒有顯示,但顯示test.html
。
嗨。謝謝回答。如果我有其他網頁怎麼辦?我該如何動態更改讓視圖= { ':{ templateUrl:'/app/profile/index.html' } }; – ssuhat