如何解决无法匹配任何路线。网址段:“ tabs / tab1”

时间:2019-05-30 13:16:25

标签: routing ionic4 ionic-tabs

我正在尝试在Ionic BLANK模板中为以下文件结构映射自定义标签

-app
---首页
---标签
---其他页面

为此,我尝试使用Google搜索,但没有为空白模板中的自定义标签提供正确的解决方案

      import { NgModule } from '@angular/core';
      import { RouterModule, Routes } from '@angular/router';
      import { TabsPage } from './tabs.page';

      const routes: Routes = [
        {
          path: 'tabs',
          component: TabsPage,
          children: [
            {
              path: 'tab1',
              children: [
                {
                  path: '',
                  loadChildren: '../home/home.module#HomePageModule',
                  pathMatch: 'full'
                }
              ]
            },
            {
              path: '',
              redirectTo: '/tabs/tab1',
              pathMatch: 'full'
            }
          ]
        }
      ];

      @NgModule({
        imports: [
          RouterModule.forChild(routes)
        ],
        exports: [RouterModule]
      })
      export class TabsPageRoutingModule {}

上面是我的tabs.routing.ts文件

以下是app-routing.module.ts

      const routes: Routes = [
        { path: '', redirectTo: 'tabs', pathMatch: 'full' },
        { path: 'login', loadChildren: './login/login.module#LoginPageModule' },
        { path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' },
      ];

对于所有选项卡,我需要将所有映射的页面显示为内部选项卡,以便在它们之间进行切换。

0 个答案:

没有答案