diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index f1c836f01a0c..f615981362fa 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -110,7 +110,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' $anchorScroll(); } - scope.$emit('$includeContentLoaded'); + childScope.$emit('$includeContentLoaded'); scope.$eval(onloadExp); }).error(function() { if (thisChangeId === changeCounter) clearContent(); diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js index ae9454d6cec5..a30ed11e95c4 100644 --- a/test/ng/directive/ngIncludeSpec.js +++ b/test/ng/directive/ngIncludeSpec.js @@ -60,9 +60,10 @@ describe('ng-include', function() { })); - it('should fire $includeContentLoaded event after linking the content', inject( + it('should fire $includeContentLoaded event on child scope after linking the content', inject( function($rootScope, $compile, $templateCache) { - var contentLoadedSpy = jasmine.createSpy('content loaded').andCallFake(function() { + var contentLoadedSpy = jasmine.createSpy('content loaded').andCallFake(function(event) { + expect(event.targetScope.$parent).toBe($rootScope); expect(element.text()).toBe('partial content'); });