Angularjs 使用多分辨率时角度UI路由器抛出错误
我使用的是Angularjs 使用多分辨率时角度UI路由器抛出错误,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我使用的是angularjsv1.6.10和angularui路由器v1.0.18,这会抛出错误: [$injector:unpr]未知提供程序:仪表板数据提供程序Aleksey Solovey非常正确。ui路由器v0.x和v1.x之间的一个突破性变化是取消了对嵌套视图中解析的支持。因此,您需要将调用移动到dbServiceout: $stateProvider.state('root.dashboard', { url: '/dashboard', resolve: { d
angularjsv1.6.10
和angularui路由器v1.0.18
,这会抛出错误:
[$injector:unpr]未知提供程序:仪表板数据提供程序Aleksey Solovey非常正确。ui路由器v0.x和v1.x之间的一个突破性变化是取消了对嵌套视图中解析的支持。因此,您需要将调用移动到
dbService
out:
$stateProvider.state('root.dashboard', {
url: '/dashboard',
resolve: {
dashboardData:function(dbService) {
return dbService.getDashboardData();
},
// Probably wrong, because I don't understand your intention here
other: loadSequence('dashBoardCtrl')
},
views: {
'': {
templateUrl: BaseURL + '/templates/dashboard/index.html',
controller: 'dashBoardCtrl'
}
}
})
文件中明确描述了这一差异。然而,我首先发现了这个SO条目,所以我在这个答案中卡住了,以帮助其他Google foo不好的人。解析应该是每个状态,而不是每个嵌套视图,但在angular ui router v0.4.2中工作。这里的函数loadSequence是什么
resolve:loadSequence('dashBoardCtrl'))
?加载顺序:在head标记中加载给定文件您是否可以在loadSequence('dashBoardCtrl')
$stateProvider.state('root.dashboard', {
url: '/dashboard',
resolve: {
dashboardData:function(dbService) {
return dbService.getDashboardData();
},
// Probably wrong, because I don't understand your intention here
other: loadSequence('dashBoardCtrl')
},
views: {
'': {
templateUrl: BaseURL + '/templates/dashboard/index.html',
controller: 'dashBoardCtrl'
}
}
})