diff options
| author | Igor Minar | 2012-03-08 15:42:35 -0800 |
|---|---|---|
| committer | Igor Minar | 2012-03-08 22:29:35 -0800 |
| commit | 5d09a1efd3ff98fc2fbba2f8f64230704f4a5e96 (patch) | |
| tree | a978ec1d082ee4e34a01090665f5ae59dc17377f /src/directive/ngInclude.js | |
| parent | f54db2ccda399f2677e4ca7588018cb31545a2b4 (diff) | |
| download | angular.js-5d09a1efd3ff98fc2fbba2f8f64230704f4a5e96.tar.bz2 | |
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
Diffstat (limited to 'src/directive/ngInclude.js')
| -rw-r--r-- | src/directive/ngInclude.js | 14 |
1 files changed, 13 insertions, 1 deletions
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 @@ </doc:scenario> </doc:example> */ + + +/** + * @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 { |
