diff options
| author | Misko Hevery | 2011-08-25 13:29:20 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-08-31 14:29:37 -0700 | 
| commit | 456c7f62c5b437aef7d23af5af9c05c30531a594 (patch) | |
| tree | 14da7ab96241bced0886881447ebbdcd0691baf3 | |
| parent | c9e7fb894beccfb3680af54a6b1469831a3b999d (diff) | |
| download | angular.js-456c7f62c5b437aef7d23af5af9c05c30531a594.tar.bz2 | |
bug($xhr.bulk): fix exceptions under some circumstances
| -rw-r--r-- | src/service/xhr.bulk.js | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/src/service/xhr.bulk.js b/src/service/xhr.bulk.js index 15bf0c83..2365be77 100644 --- a/src/service/xhr.bulk.js +++ b/src/service/xhr.bulk.js @@ -41,7 +41,9 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){      }    }    bulkXHR.urls = {}; -  bulkXHR.flush = function(success, error) { +  bulkXHR.flush = function(success, errorback) { +    assertArgFn(success = success || noop, 0); +    assertArgFn(errorback = errorback || noop, 1);      forEach(bulkXHR.urls, function(queue, url) {        var currentRequests = queue.requests;        if (currentRequests && currentRequests.length) { @@ -62,7 +64,7 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){                  $log.error(e);                }              }); -            (success || noop)(); +            success();            },            function(code, response) {              forEach(currentRequests, function(request, i) { @@ -76,12 +78,11 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){                  $log.error(e);                }              }); -            (error || noop)(); +            noop();            }); -        scope.$eval();        }      });    }; -  this.$watch(bulkXHR.flush); +  this.$watch(function(){ bulkXHR.flush(); });    return bulkXHR;  }, ['$xhr', '$xhr.error', '$log']);  | 
