代码之家  ›  专栏  ›  技术社区  ›  AbhiRam

<ion router outlet>在离子4中不工作

  •  0
  • AbhiRam  · 技术社区  · 6 年前

    嗨,我试图添加两个子页面在两个标签页在离子4使用下面的代码,但我感到困惑的是不显示管理员与两个选项卡,当我选择标签,各自的网页必须显示,但它直接显示儿童1页

    我想知道我什么时候用它工作很好,请给我推荐一个我哪里做错了?

    HTML

    <ion-content padding>
      <ion-row>
        <ion-col col-4><button ion-button color="secondary" (click)="child1()">Child1</button></ion-col>
        <ion-col col-4><button ion-button color="secondary" (click)="child2()">Child2</button></ion-col>
      </ion-row>
      <ion-router-outlet></ion-router-outlet>
    
    </ion-content> 
    

    管理路由器.module.ts

    const routes: Routes = [
        {
            path: 'Admin',
            component: AdminPage,
            children: [
                { path: '',redirectTo: '/Admin/Child1',pathMatch: 'full'},
                { path: 'Child1', component: Child1Page },
                { path: 'Child2', component: Child2Page },
            ]
        }
    ];
    

    管理模块.ts

    @NgModule({
        imports: [
            CommonModule,
            IonicModule,
            AdminRoutingModule
        ],
        declarations: [
            AdminPage,
            Child1Page,
            Child2Page
        ]
    })
    export class AdminModule {
    
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   usanov_dp    6 年前

    尝试使用角度 router-outlet 而不是 ion-router-outlet

    推荐文章