什么是jQuery.when()的角度相当于 [英] What's the equivalent of jQuery.when() in angular

查看:168
本文介绍了什么是jQuery.when()的角度相当于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jQuery的,我们能做到 $。当($就(/page1.php),$就(/page2.php)).done(功能(A1,A2){   ... }); 什么是等值的角度?我真的需要等待所有的Ajax调用完成,然后做的东西。谢谢你。

In jQuery we can do $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { ... }); What's the equivalent in angular? I really need to wait for all ajax calls finish then do stuff. Thanks.

推荐答案

您可以使用 $ q.all 来处理多个承诺。此外,使用$ HTTP打的电话,这是更有棱角。

You can use $q.all to handle multiple promises. Also, use $http to make the calls, that's more angular.

下面是一个很好的教程:

Here is a nice tutorial:

https://egghead.io/lessons/angularjs-q-all

希望有所帮助。

这篇关于什么是jQuery.when()的角度相当于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆