Skip to content

Commit fb3cfc5

Browse files
committed
Fixed issues angular-ui#142 (removing ui-view content at the first load)
1 parent 4f8f5ab commit fb3cfc5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/viewDirective.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
1212
name = attr[directive.name] || attr.name || '',
1313
onloadExp = attr.onload || '',
1414
animate = isDefined($animator) && $animator(scope, attr);
15-
15+
1616
// Find the details of the parent view directive (if any) and use it
1717
// to derive our own qualified view name, then hang our own details
1818
// off the DOM so child directives can find it.
@@ -28,11 +28,15 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
2828
var locals = $state.$current && $state.$current.locals[name];
2929
if (locals === viewLocals) return; // nothing to do
3030

31-
// Destroy previous view scope and remove content (if any)
32-
if (viewScope) {
33-
if (animate && doAnimate) animate.leave(element.contents(), element);
34-
else element.html('');
31+
// Remove existing content
32+
if (animate && doAnimate) {
33+
animate.leave(element.contents(), element);
34+
} else {
35+
element.html('');
36+
}
3537

38+
// Destroy previous view scope
39+
if (viewScope) {
3640
viewScope.$destroy();
3741
viewScope = null;
3842
}

0 commit comments

Comments
 (0)