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

Commit 199ac26

Browse files
committed
fix(ngInclude): fire $includeContentLoaded on proper (child) scope
1 parent 5f70d61 commit 199ac26

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ng/directive/ngInclude.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
110110
$anchorScroll();
111111
}
112112

113-
scope.$emit('$includeContentLoaded');
113+
childScope.$emit('$includeContentLoaded');
114114
scope.$eval(onloadExp);
115115
}).error(function() {
116116
if (thisChangeId === changeCounter) clearContent();

test/ng/directive/ngIncludeSpec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ describe('ng-include', function() {
6060
}));
6161

6262

63-
it('should fire $includeContentLoaded event after linking the content', inject(
63+
it('should fire $includeContentLoaded event on child scope after linking the content', inject(
6464
function($rootScope, $compile, $templateCache) {
65-
var contentLoadedSpy = jasmine.createSpy('content loaded').andCallFake(function() {
65+
var contentLoadedSpy = jasmine.createSpy('content loaded').andCallFake(function(event) {
66+
expect(event.targetScope.$parent).toBe($rootScope);
6667
expect(element.text()).toBe('partial content');
6768
});
6869

0 commit comments

Comments
 (0)