fix(back-button): implements back animation

This commit is contained in:
Manu Mtz.-Almeida
2018-03-08 19:27:37 +01:00
parent 8b6df5abbd
commit 64a787a9de
3 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ export class BackButton {
ev.preventDefault();
nav.pop();
} else if (this.defaultHref) {
openURL(this.defaultHref, ev);
openURL(this.defaultHref, ev, true);
}
}

View File

@ -69,8 +69,8 @@ export class Router {
}
@Method()
pushURL(url: string) {
this.writePath(parsePath(url), false);
pushURL(url: string, isPop = false) {
this.writePath(parsePath(url), isPop);
return this.writeNavStateRoot();
}

View File

@ -62,12 +62,12 @@ export function getClassMap(classes: string | undefined): CssClassMap {
return map;
}
export function openURL(url: string, ev: Event) {
export function openURL(url: string, ev: Event, isPop = false) {
if (url && url.indexOf('://') === -1) {
const router = document.querySelector('ion-router');
if (router) {
ev && ev.preventDefault();
return router.componentOnReady().then(() => router.pushURL(url));
return router.componentOnReady().then(() => router.pushURL(url, isPop));
}
}
return Promise.resolve();