更新时间:2023-02-12 08:06:48
这是***的方式来实现,如果我必须进行多个api调用和更新视图,
$scope.data = EdgeService.tickets()
应为
EdgeService.tickets().then (data) ->
$scope.data = data
AngularJS does not automatically unwrap promises in newer versions. This would work in older versions of Angular.
要执行多个依赖于彼此的API调用,您可以执行
To do multiple API calls dependant of one another you can do
callA
.then(callB)
.then(callC)
Yo可以使用$ q.all执行多个并行操作
Yo can do multiple in parallell using $q.all
$q.all([callA, callB, callC]).then( .... )