我们有以下代码:
app.js
.state('app.single', {
url: "/paths/:pathId",
views: {
'menuContent' :{
templateUrl: "templates/path.html",
controller: 'PathCtrl'
}
}
})
.state('app.single.comments', {
url: "/comments",
views: {
'menuContent' :{
templateUrl: "templates/comments.html",
controller: 'CommentsCtrl'
}
}
});
$urlRouterProvider.otherwise('/app/paths');
path.html:
<a class="tab-item" href="#/app/paths/{{path.pathid}}/comments">
<i class="icon ion-chatbox"></i>
View Comments
</a>
但是,当我单击视图注释时,它不会显示由templates/comments.html
生成的视图。它停留在当前视图/path/:pathId
app.js中的代码应该为:
.state('app.single.comments', {
url: "/comments",
views: {
'menuContent@app' :{
templateUrl: "templates/comments.html",
controller: 'CommentsCtrl'
}
}
});