UI-路由嵌套视图并解决不工作
UI-route nested views and resolve not working
我遇到了解决问题,我的嵌套视图没有加载,因为那个。我看不出问题出在哪里。这是与 ng-route 一起工作的。
这是我的情况。我们应该在其他拖车下方看到 "View3" 文本。如果您删除解决方案,它将起作用。
[http://plnkr.co/edit/p483wWVSp30LGiQMuk1r?p=preview][1]
[1]: http://plnkr.co/edit/p483wWVSp30LGiQMuk1r?p=preview
这是我下定决心的状态。问题是我使用 $route 作为参数。 $route 对于 ng-route 模块来说是可取的。
.state('test.subs.quest', {
url: '/:bob',
views: {
'quest@test': {
template: "View3",
controller: function($stateParams) {
console.log($stateParams);
}
},
},
resolve: {
Questions: function(Questionnaire, $route) {
console.log('any body here ?');
return Questionnaire.Get($route.current.params.slug);
}
}
});
应该是这样的:
.state('categories.category.questionnaire', {
url: '/:slug',
views:{
"main@":{
template: '<div compilehtml="html"></div>',
controller: 'QuestionnaireController',
}
},
resolve: {
Questions: function(Questionnaire, $stateParams ) {
return Questionnaire.Get($stateParams.slug);
}
}
})
我遇到了解决问题,我的嵌套视图没有加载,因为那个。我看不出问题出在哪里。这是与 ng-route 一起工作的。
这是我的情况。我们应该在其他拖车下方看到 "View3" 文本。如果您删除解决方案,它将起作用。
[http://plnkr.co/edit/p483wWVSp30LGiQMuk1r?p=preview][1]
[1]: http://plnkr.co/edit/p483wWVSp30LGiQMuk1r?p=preview
这是我下定决心的状态。问题是我使用 $route 作为参数。 $route 对于 ng-route 模块来说是可取的。
.state('test.subs.quest', {
url: '/:bob',
views: {
'quest@test': {
template: "View3",
controller: function($stateParams) {
console.log($stateParams);
}
},
},
resolve: {
Questions: function(Questionnaire, $route) {
console.log('any body here ?');
return Questionnaire.Get($route.current.params.slug);
}
}
});
应该是这样的:
.state('categories.category.questionnaire', {
url: '/:slug',
views:{
"main@":{
template: '<div compilehtml="html"></div>',
controller: 'QuestionnaireController',
}
},
resolve: {
Questions: function(Questionnaire, $stateParams ) {
return Questionnaire.Get($stateParams.slug);
}
}
})