diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 06609862b9fb..2e76d6ee99ed 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -165,6 +165,8 @@ function $RootScopeProvider(){ if (isolate) { child = new Scope(); child.$root = this.$root; + // ensure that there is just one async queue per $rootScope and it's children + child.$$asyncQueue = this.$$asyncQueue; } else { Child = function() {}; // should be anonymous; This is so that when the minifier munges // the name it does not become random set of chars. These will then show up as class diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js index 15990c9606bc..049258cf27c8 100644 --- a/test/ng/rootScopeSpec.js +++ b/test/ng/rootScopeSpec.js @@ -692,6 +692,19 @@ describe('Scope', function() { expect($rootScope.log).toBe('12'); })); + + it('should operate only with a single queue across all child and isolate scopes', inject(function($rootScope) { + var childScope = $rootScope.$new(); + var isolateScope = $rootScope.$new(true); + + $rootScope.$evalAsync('rootExpression'); + childScope.$evalAsync('childExpression'); + isolateScope.$evalAsync('isolateExpression'); + + expect(childScope.$$asyncQueue).toBe($rootScope.$$asyncQueue); + expect(isolateScope.$$asyncQueue).toBe($rootScope.$$asyncQueue); + expect($rootScope.$$asyncQueue).toEqual(['rootExpression', 'childExpression', 'isolateExpression']); + })); });