Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9bd2c39

Browse files
committed
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.
1 parent 38ec651 commit 9bd2c39

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/widgets.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,11 @@ angularWidget('ng:view', function(element) {
10721072
}
10731073

10741074
if (src) {
1075-
$xhr('GET', src, null, function(code, response){
1075+
//xhr's callback must be async, see commit history for more info
1076+
$xhr('GET', src, function(code, response){
10761077
element.html(response);
10771078
compiler.compile(element)(childScope);
1078-
}, false, true);
1079+
});
10791080
} else {
10801081
element.html('');
10811082
}

0 commit comments

Comments
 (0)