gpt4 book ai didi

angular - 如何使用链式调用 Promise?

转载 作者:搜寻专家 更新时间:2023-10-30 22:04:47 24 4
gpt4 key购买 nike

现在在 .then 部分我所有另一个 promise http 请求:

.then(result => { this.service().then(data => {}); });

这是使用链式 promise 的正确方法吗?

最佳答案

差不多了!您需要在函数中返回 promise ,或者像这样:

.then(result => { return this.service().then(data => {}); });

或者像这样:

.then(result => this.service().then(data => {}));

关于angular - 如何使用链式调用 Promise?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45926739/

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