我正在使用
Angularjs 1.3.7,并且发现Promise.all在成功响应后不更新angularjs视图,而$q.all确实如此.这是后来改变,因为Promises包含在原生javascript中或者背后的原因是什么?
解决方法
正如
IAmDranged在
comment中提到的那样:
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不会触发摘要周期.