mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(angular): accept other url schemas
This commit is contained in:

committed by
Manu MA

parent
276c883493
commit
e8e71838b3
@ -32,9 +32,11 @@ export class HrefDelegate {
|
|||||||
this.navCtrl.setDirection(this.routerDirection);
|
this.navCtrl.setDirection(this.routerDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.routerLink && this.router && url != null && url[0] !== '#' && url.indexOf('://') === -1) {
|
if (!this.routerLink && this.router && url != null && url[0] !== '#' && !SCHEME.test(url)) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.router.navigateByUrl(url);
|
this.router.navigateByUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SCHEME = /^[a-z][a-z0-9+\-.]*:/;
|
||||||
|
@ -38,8 +38,10 @@ export function getClassMap(classes: string | string[] | undefined): CssClassMap
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SCHEME = /^[a-z][a-z0-9+\-.]*:/;
|
||||||
|
|
||||||
export async function openURL(win: Window, url: string | undefined | null, ev: Event | undefined | null, direction: RouterDirection): Promise<boolean> {
|
export async function openURL(win: Window, url: string | undefined | null, ev: Event | undefined | null, direction: RouterDirection): Promise<boolean> {
|
||||||
if (url != null && url[0] !== '#' && url.indexOf('://') === -1) {
|
if (url != null && url[0] !== '#' && !SCHEME.test(url)) {
|
||||||
const router = win.document.querySelector('ion-router');
|
const router = win.document.querySelector('ion-router');
|
||||||
if (router) {
|
if (router) {
|
||||||
if (ev != null) {
|
if (ev != null) {
|
||||||
|
Reference in New Issue
Block a user