aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVojta Jina2012-03-30 13:54:43 -0700
committerVojta Jina2012-04-03 10:10:44 -0700
commit199ac269869a57bb63d60c9b3f510d546bf0c9b2 (patch)
tree4274d80c13734735923c725cb8c38e04feae253a
parent5f70d615a5f7e102424c6adc15d7a6f697870b6e (diff)
downloadangular.js-199ac269869a57bb63d60c9b3f510d546bf0c9b2.tar.bz2
fix(ngInclude): fire $includeContentLoaded on proper (child) scope
-rw-r--r--src/ng/directive/ngInclude.js2
-rw-r--r--test/ng/directive/ngIncludeSpec.js5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js
index f1c836f0..f6159813 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 ae9454d6..a30ed11e 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');
});