aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVojta Jina2012-02-19 12:59:10 -0800
committerVojta Jina2012-02-28 17:48:07 -0800
commit60743fc52aea9eabee58258a31f4ba465013cb4e (patch)
treef148f23deab430bb33f84925af9f2afee17ac075 /src
parent9486590e1be7282bb0e87586a35ca0bee6c64ee0 (diff)
downloadangular.js-60743fc52aea9eabee58258a31f4ba465013cb4e.tar.bz2
feat(ng:include) Fire $contentLoaded event
+ refactor unload to listen on this event -> we can use unload with ng:view as well Closes #743
Diffstat (limited to 'src')
-rw-r--r--src/AngularPublic.js1
-rw-r--r--src/directives.js12
-rw-r--r--src/service/route.js2
-rw-r--r--src/widgets.js3
4 files changed, 15 insertions, 3 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js
index 20ca5edb..e65f1281 100644
--- a/src/AngularPublic.js
+++ b/src/AngularPublic.js
@@ -72,6 +72,7 @@ function publishExternalAPI(angular){
script: scriptTemplateLoader,
select: selectDirective,
style: styleDirective,
+ onload: onloadDirective,
option: optionDirective,
ngBind: ngBindDirective,
ngBindHtml: ngBindHtmlDirective,
diff --git a/src/directives.js b/src/directives.js
index 2d42d3ef..c988bf7b 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -975,3 +975,15 @@ var styleDirective = valueFn({
restrict: 'E',
terminal: true
});
+
+
+var onloadDirective = valueFn({
+ restrict: 'AC',
+ link: function(scope, elm, attr) {
+ var onloadExp = attr.onload || ''; //workaround for jquery bug #7537)
+
+ scope.$on('$contentLoaded', function(event) {
+ scope.$eval(onloadExp);
+ });
+ }
+});
diff --git a/src/service/route.js b/src/service/route.js
index 8d8086af..50f335a2 100644
--- a/src/service/route.js
+++ b/src/service/route.js
@@ -177,7 +177,7 @@ function $RouteProvider(){
* @ngdoc event
* @name angular.module.ng.$route#$routeUpdate
* @eventOf angular.module.ng.$route
- * @eventType emit on the current route scope
+ * @eventType broadcast on root scope
* @description
*
* The `reloadOnSearch` property has been set to false, and we are reusing the same
diff --git a/src/widgets.js b/src/widgets.js
index 6d64730f..a32abb75 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -68,7 +68,6 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
compile: function(element, attr) {
var srcExp = attr.src,
scopeExp = attr.scope || '',
- onloadExp = attr.onload || '', //workaround for jquery bug #7537
autoScrollExp = attr.autoscroll;
if (!element[0]['ng:compiled']) {
element[0]['ng:compiled'] = true;
@@ -106,7 +105,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll();
}
- scope.$eval(onloadExp);
+ scope.$emit('$contentLoaded');
}
}).error(clearContent);
} else {