Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3967f5f

Browse files
committed
fix(Scope): ensure that isolate scopes use the main evalAsync queue
Previously any $evalAsync task scheduled from a isolate scope or a child of an isolate scope would never execute because we never flushed this queue
1 parent e14e219 commit 3967f5f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ng/rootScope.js

+2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ function $RootScopeProvider(){
165165
if (isolate) {
166166
child = new Scope();
167167
child.$root = this.$root;
168+
// ensure that there is just one async queue per $rootScope and it's children
169+
child.$$asyncQueue = this.$$asyncQueue;
168170
} else {
169171
Child = function() {}; // should be anonymous; This is so that when the minifier munges
170172
// the name it does not become random set of chars. These will then show up as class

test/ng/rootScopeSpec.js

+13
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,19 @@ describe('Scope', function() {
692692
expect($rootScope.log).toBe('12');
693693
}));
694694

695+
696+
it('should operate only with a single queue across all child and isolate scopes', inject(function($rootScope) {
697+
var childScope = $rootScope.$new();
698+
var isolateScope = $rootScope.$new(true);
699+
700+
$rootScope.$evalAsync('rootExpression');
701+
childScope.$evalAsync('childExpression');
702+
isolateScope.$evalAsync('isolateExpression');
703+
704+
expect(childScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
705+
expect(isolateScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
706+
expect($rootScope.$$asyncQueue).toEqual(['rootExpression', 'childExpression', 'isolateExpression']);
707+
}));
695708
});
696709

697710

0 commit comments

Comments
 (0)