diff options
| author | Ali Mills | 2012-06-01 14:50:01 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2012-06-04 17:43:14 -0700 | 
| commit | 1904596e0c2330299e92f092bd7a6ceca8e97c30 (patch) | |
| tree | 4906472c23b2be76a743a7722d079761b3faea85 /src/ng/timeout.js | |
| parent | 22143381d80482f5145e984a498a9549ad7f4e53 (diff) | |
| download | angular.js-1904596e0c2330299e92f092bd7a6ceca8e97c30.tar.bz2 | |
fix($timeout): allow calling $timeout.cancel() with undefined
This is how it worked in rc9, before refactoring $defer into $timeout.
Diffstat (limited to 'src/ng/timeout.js')
| -rw-r--r-- | src/ng/timeout.js | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/src/ng/timeout.js b/src/ng/timeout.js index ac92bf8c..5b51f85e 100644 --- a/src/ng/timeout.js +++ b/src/ng/timeout.js @@ -70,12 +70,12 @@ function $TimeoutProvider() {        * Cancels a task associated with the `promise`. As a result of this the promise will be        * resolved with a rejection.        * -      * @param {Promise} promise Promise returned by the `$timeout` function. +      * @param {Promise=} promise Promise returned by the `$timeout` function.        * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully        *   canceled.        */      timeout.cancel = function(promise) { -      if (promise.$$timeoutId in deferreds) { +      if (promise && promise.$$timeoutId in deferreds) {          deferreds[promise.$$timeoutId].reject('canceled');          return $browser.defer.cancel(promise.$$timeoutId);        } | 
