Angularjs ui路由器-嵌套状态
我们有以下代码: app.jsAngularjs ui路由器-嵌套状态,angularjs,ionic-framework,angular-ui-router,Angularjs,Ionic Framework,Angular Ui Router,我们有以下代码: app.js .state('app.single', { url: "/paths/:pathId", views: { 'menuContent' :{ templateUrl: "templates/path.html", controller: 'PathCtrl' } } }) .state('app.single.comments', {
.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>
但是,当我单击view comment时,它不会显示由模板/comments.html
生成的视图。它保持在当前视图中/path/:pathId
app.js中的代码应该是:
.state('app.single.comments', {
url: "/comments",
views: {
'menuContent@app' :{
templateUrl: "templates/comments.html",
controller: 'CommentsCtrl'
}
}
});
您是否在path.html中包含了ui视图标记?@cbass您介意详细说明一下吗?我正在开发一个ionic框架应用程序,我根本没有ui视图。我使用的是ion view,而不是ion view。那么您如何显示其他子视图呢?在path.html中:您可以提供plunker或JSFIDLE链接吗?谢谢!这很有帮助:)