'Deep link works, but causes a menu to disappear
I have a deeplink in my app with ionic 5 and I'm using Firebase dynamic link with all configuration as assetlinks and others. The link allows me go to internal page in app but the menu located at bottom disappears.
I executed
npm install @ionic-native/deeplinks
cordova plugin add ionic-plugin-deeplinks (Including url scheme and host from firebase dynamic link)
This is my code in app.component.ts
import { Component, NgZone } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { TranslateService } from '@ngx-translate/core';
import { WonderPush } from '@awesome-cordova-plugins/wonderpush/ngx';
import { NavigationEnd, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { Deeplinks } from '@ionic-native/deeplinks/ngx';
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private translate: TranslateService,
private wonderPush: WonderPush,
private deeplinks: Deeplinks,
private router: Router,
private zone: NgZone
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.setupDeeplinks();
});
}
setupDeeplinks() {
if (this.platform.is('cordova')){
this.deeplinks.route({
'/market-update': 'market-update'
}).subscribe(match => {
console.log('Successfully matched route', match);
const path = `/${match.$route}/`;
this.zone.run(() => {
this.router.navigateByUrl(path);
});
},
nomatch => {
alert(`Got a deeplink that didn't match ${nomatch}`);
});
}
}
HTML app.componnet.html
<ion-app>
<ion-router-outlet></ion-router-outlet>
</ion-app>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
