Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(routing): ng-view now clears the template when route is deactivated
Browse files Browse the repository at this point in the history
Closes #245
  • Loading branch information
pavelgj committed Oct 30, 2013
1 parent 46093e1 commit 681e7dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/routing/ng_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ class NgViewDirective implements NgDetachAware {
locationService._unregisterPortal(this);
}

_show(String templateUrl) {
_show(String templateUrl, Route route) {
assert(route.isActive);
var subscription;
subscription = route.onLeave.listen((_) {
subscription.cancel();
_cleanUp();
_prevTemplateUrl = null;
});
if (_prevTemplateUrl == templateUrl) return;
_prevTemplateUrl = templateUrl;

Expand Down
2 changes: 1 addition & 1 deletion lib/routing/routing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _RoutingHelper {
_routePath(route).startsWith(_routePath(v.route));
}, orElse: () => null);
if (view != null && !alreadyActiveViews.contains(view)) {
view._show(templateUrl);
view._show(templateUrl, route);
alreadyActiveViews.add(view);
break;
}
Expand Down

0 comments on commit 681e7dd

Please sign in to comment.