[英]after login when click hardware back button navigated to login page how to prevent it in ionic 4
const routes: Routes = [ { path: '', component: TabsPage, children: [ //new page add { path: 'home', children: [ { path: '', loadChildren: () => import('../AllPages/home/home.module').then(m => m.HomePageModule) }, { path: 'new-arrival', children: [ { path: '', loadChildren: () => import('../AllPages/new-arrival/new-arrival.module').then(m => m.NewArrivalPageModule) }, { path: 'product-item-list', children: [ { path: '', loadChildren: () => import('../Allpages/product-item-list/product-item-list.module').then(m => m.ProductItemListPageModule) }, { path: 'product-details', children: [ { path: '', loadChildren: () => import('../Allpages/product-details/product-details.module').then(m => m.ProductDetailsPageModule) }, ] } ] } ] },
Use Ionic NavController instead of Angular Router.使用 Ionic NavController 代替 Angular 路由器。
Then, use the navigateRoot
method.然后,使用
navigateRoot
方法。
Going root means that all existing pages in the stack will be removed, and the navigated page will become the single page in the stack.
去根意味着堆栈中的所有现有页面都将被删除,导航页面将成为堆栈中的单个页面。
import { NavController } from '@ionic/angular';
...
constructor(private navController: NavController) {}
...
this.navController.navigateRoot('/tabs/home');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.