diff options
Diffstat (limited to 'src/ngRoute')
| -rw-r--r-- | src/ngRoute/directive/ngView.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index 3fa851a7..448e375c 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -189,6 +189,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) { link: function(scope, $element, attr, ctrl, $transclude) { var currentScope, currentElement, + previousElement, autoScrollExp = attr.autoscroll, onloadExp = attr.onload || ''; @@ -196,12 +197,19 @@ function ngViewFactory( $route, $anchorScroll, $animate) { update(); function cleanupLastView() { - if (currentScope) { + if(previousElement) { + previousElement.remove(); + previousElement = null; + } + if(currentScope) { currentScope.$destroy(); currentScope = null; } if(currentElement) { - $animate.leave(currentElement); + $animate.leave(currentElement, function() { + previousElement = null; + }); + previousElement = currentElement; currentElement = null; } } |
