Angularjs Promise.all没有更新范围,而$q.all确实如此

前端之家收集整理的这篇文章主要介绍了Angularjs Promise.all没有更新范围,而$q.all确实如此前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 Angularjs 1.3.7,并且发现Promise.all在成功响应后不更新angularjs视图,而$q.all确实如此.这是后来改变,因为Promises包含在原生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相关文章