阿贾克斯成功Vs然后(有角度的承诺)

时间:2017-03-02 05:17:09

标签: angularjs

我打算在我的应用程序中使用angularjs promises。但是我没有得到.success函数和.then函数之间的实际区别。

1 个答案:

答案 0 :(得分:1)

1。advantages of promises is the ability to flatten and chain potentially complex sequences of ajax calls. Not only does this help us simplify code, but more importantly, it helps us manage timing and dependencies through a sequence of calls.

2。The fundamental difference between 'success' and 'then' is that success will return the original promise instead of returning a new derived promise. Each then() invocation returns a fresh promise – which is key to chaining multiple promise calls.

详细差异check here