无法从状态 'app.<something2>' 解析“#/app/<something1>”
Could not resolve '#/app/<something1>' from state 'app.<something2>'
$state.go('#/app/list',{ 'id':id});
return 出现此错误:
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'
}
}
})
我怎样才能让它发挥作用?
谢谢
$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)
Absolute state name or relative state path. Some examples:
$state.go('contact.detail')
- will go to the contact.detail state
$state.go('^')
- will go to a parent state
$state.go('^.sibling')
- will go to a sibling state
$state.go('.child.grandchild')
- will go to grandchild state
$state.go('#/app/list',{ 'id':id});
return 出现此错误:
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'
}
}
})
我怎样才能让它发挥作用? 谢谢
$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)
Absolute state name or relative state path. Some examples:
$state.go('contact.detail')
- will go to the contact.detail state$state.go('^')
- will go to a parent state$state.go('^.sibling')
- will go to a sibling state$state.go('.child.grandchild')
- will go to grandchild state