Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用多分辨率时角度UI路由器抛出错误_Angularjs_Angular Ui Router - Fatal编程技术网

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'
    }
  }
})