Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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,我已经这样做了: resolve: { required_data: function($q, testService) { return $q.all([ testService.getAdminTestLevel(), testService.getAdminTestStatus(), testService.getAdminTestType() ]) } } 我是否可以

我已经这样做了:

resolve: {
    required_data: function($q, testService) {
        return $q.all([
            testService.getAdminTestLevel(),
            testService.getAdminTestStatus(),
            testService.getAdminTestType()
        ])
    }
}
我是否可以仅通过将函数连接到
解析:

否,在没有所需数据的情况下对其进行编码。他说,

resolve属性是一个映射对象

选择此选项可能是为了方便在路线上访问已解析的数据。它在ngRoute和ui路由器中都是这样工作的


您可以通过使函数中的内容成为testService的方法来简化,然后运行
函数(testService),{return testService.doAdminChecks();}
或类似程序

此外,它需要注入一个名称。