diff options
| -rw-r--r-- | src/ng/rootScope.js | 2 | ||||
| -rw-r--r-- | test/ng/rootScopeSpec.js | 9 | 
2 files changed, 11 insertions, 0 deletions
| diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 1d8d4e77..13ee4c70 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -562,6 +562,7 @@ function $RootScopeProvider(){                asyncTask = asyncQueue.shift();                asyncTask.scope.$eval(asyncTask.expression);              } catch (e) { +              clearPhase();                $exceptionHandler(e);              }            } @@ -594,6 +595,7 @@ function $RootScopeProvider(){                      }                    }                  } catch (e) { +                  clearPhase();                    $exceptionHandler(e);                  }                } diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js index 894c26d2..69447a3c 100644 --- a/test/ng/rootScopeSpec.js +++ b/test/ng/rootScopeSpec.js @@ -127,6 +127,15 @@ describe('Scope', function() {        });      }); +    it('should clear phase if an exception interrupt $digest cycle', function() { +      inject(function($rootScope) { +        $rootScope.$watch('a', function() {throw new Error('abc');}); +        $rootScope.a = 1; +        try { $rootScope.$digest(); } catch(e) { } +        expect($rootScope.$$phase).toBeNull(); +      }); +    }); +      it('should fire watches in order of addition', inject(function($rootScope) {        // this is not an external guarantee, just our own sanity | 
