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.
This commit is contained in:
Igor Minar 2011-04-04 15:28:21 -07:00
parent 38ec6519a3
commit 9bd2c3967b

View file

@ -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('');
}