$state.go('#/app/list',{ 'id':id});
返回此错误:
Could not resolve '#/app/list' from state 'app.myPage'
这是我在myApp.js中定义相关状态的方式:
.state('app.list', {
url: "/lists/:listId",
views: {
'menuContent': {
templateUrl: "templates/listDashboard.html",
controller: 'listDashboardCtrl'
}
}
});
.state('app.myPage', {
url: "/myPage",
views: {
'menuContent': {
templateUrl: "templates/myPage.html",
controller : 'myPageCtrl'
}
}
})
我怎样才能让它发挥作用? 感谢
答案 0 :(得分:0)
$state.go()
期望州名称作为第一个参数 to
(不是 url )
// instead of this
//$state.go('#/app/list',{ 'id':id});
// we should use this
$state.go('app.list',{ 'id':id});
检查$state
服务
$state.go(to, params, options)
绝对州名或相对州路径。一些例子:
$state.go('contact.detail')
- 将转至contact.detail州$state.go('^')
- 将转到父州$state.go('^.sibling')
- 将进入兄弟姐妹州$state.go('.child.grandchild')
- 将去孙子州