gpt4 book ai didi

AngularJS : multiple resolves in ui. 路由器

转载 作者:行者123 更新时间:2023-12-02 01:27:59 25 4
gpt4 key购买 nike

我正在努力实现这样的目标:

 $stateProvider.state('app', {
url: "/app",
templateUrl: "assets/views/app.html",
resolve: {
authorize: ['authorization',
function(authorization) {
return authorization.authorize();
}
],
loadSequence: loadSequence('chartjs', 'chart.js', 'chatCtrl')
},
abstract: true

解析“授权”然后“LoadSequence”函数,但我得到的错误令人困惑,我无法弄清楚如何正确地做到这一点:

Error: ng:areq Bad Argument Argument 'fn' is not a function, got Object

最好的问候。

最佳答案

我认为您需要像第一个一样将 resolve 中的第二个项目包装在一个函数中:

$stateProvider.state('app', {
url: "/app",
templateUrl: "assets/views/app.html",
resolve: {
authorize: ['authorization',
function(authorization) {
return authorization.authorize();
}
],
loadSequence: function(){
return loadSequence('chartjs', 'chart.js', 'chatCtrl');
}
},
abstract: true

此外,如果 loadSequence 没有返回 promise ,则它需要返回。

关于AngularJS : multiple resolves in ui. 路由器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35945087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com