mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(button): goback attribute
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { CssClassMap } from '../index';
|
||||
import { RouterDirection } from '../components/router/utils/interfaces';
|
||||
|
||||
/**
|
||||
* Create the mode and color classes for the component based on the classes passed in
|
||||
@@ -66,14 +65,13 @@ export function getClassMap(classes: string | undefined): CssClassMap {
|
||||
return map;
|
||||
}
|
||||
|
||||
export function openURL(url: string, ev: Event, direction = RouterDirection.Forward) {
|
||||
export function openURL(url: string, ev: Event, goBack = false) {
|
||||
if (url && url[0] !== '#' && url.indexOf('://') === -1) {
|
||||
const router = document.querySelector('ion-router');
|
||||
if (router) {
|
||||
ev && ev.preventDefault();
|
||||
return router.componentOnReady().then(() => router.push(url, direction));
|
||||
return router.componentOnReady().then(() => router.push(url, goBack ? -1 : 1));
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user