From 9bd2c3967ba210cd349299a7546854eccc619e96 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 4 Apr 2011 15:28:21 -0700 Subject: revert ng:view sync caching sync caching in ng:view must be reverted becase ng:view uses $route.onChange to listen for changes. $route fires all onChange events before it calls $become(Controller) which means that if the template being included via ng:view contains ng:controller, ng:include or other widget that create new scopes, these scopes will be created and initialized before the parent scope is fully initialized (happens after $become is called). For this reason ng:view must be async. The new scope implemenetation will resolve this issue by providing us with an api to register one-off tasks to be executed during the flush phase. We'll be able to compile and link the included template safely at this time. --- src/widgets.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets.js b/src/widgets.js index 2b44fccc..6d5ffe65 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -1072,10 +1072,11 @@ angularWidget('ng:view', function(element) { } if (src) { - $xhr('GET', src, null, function(code, response){ + //xhr's callback must be async, see commit history for more info + $xhr('GET', src, function(code, response){ element.html(response); compiler.compile(element)(childScope); - }, false, true); + }); } else { element.html(''); } -- cgit v1.2.3