gpt4 book ai didi

Angularjs Promise.all 不会更新范围,而 $q.all 会

转载 作者:行者123 更新时间:2023-12-05 00:16:53 35 4
gpt4 key购买 nike

我正在使用 Angularjs 1.3.7,刚刚发现 Promise.all 在成功响应后不会更新 angularjs View ,而 $q.all 会。由于 Promises 包含在 native javascript 中,这后来是否有所改变,或者这背后的原因是什么?

最佳答案

IAmDrangedcomment 中提及:

Probably yeah, because the Promise API is not integrated with the angular mechanism - meaning essentially that it doesn't trigger a digest cycle at key point of the lifecycle of the promises. Try adding a $scope.$apply() at the end of the Promise.all() callback function to trigger a digest cycle manually.



已确认 Promise.all 不会触发摘要循环。

关于Angularjs Promise.all 不会更新范围,而 $q.all 会,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41243148/

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