I am developing a pwa in ionic/angular and I have a problem with tabs using the pwa from Android. Basically there are 3 tabs: Home | Shopping | Favourites
Each tab then contains subpaths . The problem is that if for example I am in Home/about and I click on Shopping, then I click on home again, then Shopping etc several times . This results in new states being entered in window.history and if I use the Android hardware back button it makes me navigate between home/about and Shopping several times. Instead I would like the following case: if I am in Shopping I go back to home/about, then home and then the app closes. Is this feasible? I have tried using both skipLocationChange and replaceUrl of the router object, for example:
export class TabsPage {
constructor(private router: Router) {}
goToShopping(){
this.router.navigate(["/tabs/shopping"], {replaceUrl: true})
}
}
Tabs template:
<ion-tabs>
<ion-tab-bar slot="bottom" (click)="goToHome()">
<ion-tab-button tab="home">
<ion-icon name="home"></ion-icon>
<ion-label>Home</ion-label>
</ion-tab-button>
<ion-tab-button tab="shopping" (click)="goToShopping()">
<ion-icon name="card"></ion-icon>
<ion-label>Shopping</ion-label>
</ion-tab-button>
<ion-tab-button tab="favourites" (click)="goToFavourites()">
<ion-icon name="star"></ion-icon>
<ion-label>Favourites</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
With this, however, if I am in Home/About and then click on the Shopping tab and press the hardware back button it goes to Home because it rightly replaces the current state of About with Shopping