diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index 7b0d020bf5f2..d041d6d86255 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -159,6 +159,9 @@ * @eventType emit on the current ngInclude scope * @description * Emitted every time the ngInclude content is reloaded. + * + * @param {Object} angularEvent Synthetic event object. + * @param {String} src Source URL. */ @@ -234,7 +237,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate' currentScope = newScope; currentElement = clone; - currentScope.$emit('$includeContentLoaded'); + currentScope.$emit('$includeContentLoaded', src); scope.$eval(onloadExp); }).error(function() { if (thisChangeId === changeCounter) { diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js index 828c6d2056fb..35bbb16bfac0 100644 --- a/test/ng/directive/ngIncludeSpec.js +++ b/test/ng/directive/ngIncludeSpec.js @@ -360,6 +360,14 @@ describe('ngInclude', function() { } catch (e) {} })); + it('should fire $includeContentLoaded with the template url as the second parameter', inject(function($rootScope, $compile, $templateCache) { + var handlerSpy = jasmine.createSpy('handler'); + $templateCache.put('/some/template.html', [200, '', {}]); + $rootScope.$on('$includeContentLoaded', handlerSpy); + element = $compile('
')($rootScope); + $rootScope.$digest(); + expect(handlerSpy).toHaveBeenCalledWith(jasmine.any(Object), '/some/template.html'); + })); describe('autoscroll', function() { var autoScrollSpy;