mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feature(routing): create external router controller for reconciling state from router in re-useable fashion
* external router controller * external router controller * gif it's working
This commit is contained in:
@@ -25,3 +25,13 @@ export function removeAllNodeChildren(element: HTMLElement) {
|
||||
export function isString(something: any) {
|
||||
return typeof something === 'string' ? true : false;
|
||||
}
|
||||
|
||||
export function ensureExternalRounterController(): Promise<HTMLIonExternalRouterControllerElement> {
|
||||
const element = document.querySelector('ion-external-router-controller');
|
||||
if (element) {
|
||||
return (element as any).componentOnReady();
|
||||
}
|
||||
const toCreate = document.createElement('ion-external-router-controller');
|
||||
document.body.appendChild(toCreate);
|
||||
return (toCreate as any).componentOnReady();
|
||||
}
|
||||
Reference in New Issue
Block a user