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

Commit

Permalink
fix(ngInclude): fire $includeContentLoaded on proper (child) scope
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Apr 3, 2012
1 parent 5f70d61 commit 199ac26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ng/directive/ngInclude.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions test/ng/directive/ngIncludeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down

0 comments on commit 199ac26

Please sign in to comment.