zl程序教程

您现在的位置是:首页 >  其它

当前栏目

[AngularJS] Promises, handler error. 5. example

Error angularjs handler Example promises
2023-09-14 08:59:21 时间

The deferred object has a property promise which represents the promise of this task. With this promise we can register an on success and an on failure function. Both functions take a single parameter. The on success function gets the value that was provided by the caller of the resolve method while the on failure function gets the value (reason of failure) provided by the caller of the reject function:

var defer = $q.defer(),
     promise = defer.promise;

promise.then(successFn, errorFn);

 

-------------------Example-----------------

Read More:

http://lostechies.com/gabrielschenker/2014/02/04/angularjspart-11-promises/