Angularjs Promise.all 不更新作用域,而 $q.all 会
Angularjs Promise.all not updating scope, while $q.all does
我正在使用 Angularjs 1.3.7,刚刚发现 Promise.all 在成功响应后不会更新 angularjs 视图,而 $q.all 会。由于 Promise 包含在本机 javascript 中,这后来是否有所更改,或者这背后的原因是什么?
作为IAmDranged mentions in a :
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 1.3.7,刚刚发现 Promise.all 在成功响应后不会更新 angularjs 视图,而 $q.all 会。由于 Promise 包含在本机 javascript 中,这后来是否有所更改,或者这背后的原因是什么?
作为IAmDranged mentions in a
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 没有触发摘要循环。