From fe5ce7b8b8babffb8853127392506cc5e6dae045 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 17 Jul 2015 10:37:22 -0500 Subject: [PATCH] app.stateClear() for setRoot() --- ionic/components/app/app.ts | 4 ++++ ionic/components/view/view-controller.ts | 2 ++ ionic/routing/router.ts | 6 ++++++ ionic/routing/url-state.ts | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/ionic/components/app/app.ts b/ionic/components/app/app.ts index 808b562b8b..6d79dbed14 100644 --- a/ionic/components/app/app.ts +++ b/ionic/components/app/app.ts @@ -63,6 +63,10 @@ export class IonicApp { } } + stateClear() { + this.router.stateClear(); + } + /** * Register a known component with a key, for easy lookups later. */ diff --git a/ionic/components/view/view-controller.ts b/ionic/components/view/view-controller.ts index 609f91e724..27b2366880 100644 --- a/ionic/components/view/view-controller.ts +++ b/ionic/components/view/view-controller.ts @@ -140,6 +140,8 @@ export class ViewController extends Ion { return Promise.resolve(); } + this.app.stateClear(); + // if animate has not been set then default to false opts.animate = opts.animate || false; diff --git a/ionic/routing/router.ts b/ionic/routing/router.ts index b26c698840..d7a1fb93b7 100644 --- a/ionic/routing/router.ts +++ b/ionic/routing/router.ts @@ -53,6 +53,12 @@ export class IonicRouter { } } + stateClear() { + for (let name in stateManagers) { + stateManagers[name].stateClear(); + } + } + matchPaths(paths) { // load each of paths to a component let components = []; diff --git a/ionic/routing/url-state.ts b/ionic/routing/url-state.ts index 99572d7b70..018675505a 100644 --- a/ionic/routing/url-state.ts +++ b/ionic/routing/url-state.ts @@ -96,6 +96,10 @@ class UrlStateManager { this._currentPath = null; } + stateClear() { + this.paths([]); + } + onLocationChange() { let currentPath = this.getCurrentPath();