加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 有没有办法可以简化angular-ui-router解决方案?

发布时间:2020-12-17 17:26:14 所属栏目:安全 来源:网络整理
导读:我已经这样做了: resolve: { required_data: function($q,testService) { return $q.all([ testService.getAdminTestLevel(),testService.getAdminTestStatus(),testService.getAdminTestType() ]) }} 我是否可以通过将函数连接到resolve来编写没有required
我已经这样做了:

resolve: {
    required_data: function($q,testService) {
        return $q.all([
            testService.getAdminTestLevel(),testService.getAdminTestStatus(),testService.getAdminTestType()
        ])
    }
}

我是否可以通过将函数连接到resolve来编写没有required_data的代码:?

解决方法

不,angular-ui-router wiki说,

The resolve property is a map object.

可能选择这样可以在路线上轻松访问已解析的数据.它在ngRoute和ui-router中都是这样的.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读