aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIgor Minar2011-04-04 15:28:21 -0700
committerIgor Minar2011-04-04 15:35:28 -0700
commit9bd2c3967ba210cd349299a7546854eccc619e96 (patch)
treeffa739abc31ebc22de8b95032e471affad549f60 /src
parent38ec6519a37c1404c02cf7eb6487dc3d18d3e74f (diff)
downloadangular.js-9bd2c3967ba210cd349299a7546854eccc619e96.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/widgets.js5
1 files changed, 3 insertions, 2 deletions
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('');
}