From 5d09a1efd3ff98fc2fbba2f8f64230704f4a5e96 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 8 Mar 2012 15:42:35 -0800 Subject: fix(ng-view, ng-include): onload and $contentLoaded - change custom onload directive to special arguments recongnized by both ng-view and ng-include - rename $contentLoaded event to $viewContentLoaded and $includeContentLoaded - add event docs --- src/directive/ngInclude.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/directive/ngInclude.js') diff --git a/src/directive/ngInclude.js b/src/directive/ngInclude.js index 08b14488..68a03d35 100644 --- a/src/directive/ngInclude.js +++ b/src/directive/ngInclude.js @@ -63,6 +63,16 @@ */ + + +/** + * @ngdoc event + * @name angular.module.ng.$compileProvider.directive.ng:include#$includeContentLoaded + * @eventOf angular.module.ng.$compileProvider.directive.ng:include + * @eventType emit on the current ng:include scope + * @description + * Emitted every time the ng:include content is reloaded. + */ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', function($http, $templateCache, $anchorScroll, $compile) { return { @@ -70,6 +80,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' compile: function(element, attr) { var srcExp = attr.src, scopeExp = attr.scope || '', + onloadExp = attr.onload || '', autoScrollExp = attr.autoscroll; return function(scope, element, attr) { @@ -106,7 +117,8 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { $anchorScroll(); } - scope.$emit('$contentLoaded'); + scope.$emit('$includeContentLoaded'); + scope.$eval(onloadExp); } }).error(clearContent); } else { -- cgit v1.2.3