mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-13 09:13:12 +00:00
fix(ngInclude): fire $includeContentLoaded on proper (child) scope
This commit is contained in:
parent
5f70d615a5
commit
199ac26986
2 changed files with 4 additions and 3 deletions
|
|
@ -110,7 +110,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
||||||
$anchorScroll();
|
$anchorScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.$emit('$includeContentLoaded');
|
childScope.$emit('$includeContentLoaded');
|
||||||
scope.$eval(onloadExp);
|
scope.$eval(onloadExp);
|
||||||
}).error(function() {
|
}).error(function() {
|
||||||
if (thisChangeId === changeCounter) clearContent();
|
if (thisChangeId === changeCounter) clearContent();
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
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');
|
expect(element.text()).toBe('partial content');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue