角度路由器无法按预期工作

时间:2018-03-01 21:08:49

标签: angular routes

我对Angular5路由器有一些疑问,我生成了如下的根路由。

export const routes: Routes = [
    {
        path:'',
        loadChildren:'./feature1/index#Feature1Module'
    },
    { 
        path:'**',
        component: ErrorComponent
    }
]

我编写app.component.html的方式如下。

<div>
  <header></header>
  <router-outlet></router-outlet>
  <footer></footer>
</div>

然后,我在Feature1中生成了第二条路线,如下所示。

export const Feature1Routes = [
    {
        path: '', redirectTo: 'feature1', pathMatch: 'full'
    },
    {
        path:'feature1',
        component: Feature1Component
    }
]

从这个路线的构成,我期待

<header> 
<feature1>
<footer>

然而,我现在看的是

<header>
<footer>
<feature1>

有没有人对这种情况有任何想法?这很奇怪.. :(

0 个答案:

没有答案
相关问题