小编yul*_*dev的帖子

Angular 6 默认路由未加载。我怎样才能解决这个问题?

我有一个 angular 6 项目,结构如下...

src
|- app
|  |- core
|  |  |- layout.component.ts/html/scss
|  |  |- core.module.ts
|  |- views
|  |  |- modules
|  |  |  |- sample
|  |  |  |  |- sample.component.ts/html/scss
|  |  |  |  |- sample-routing.module.ts
|  |  |  |  |- sample.module.ts
|- app.component.ts/html/scss
|- app-routing.module.ts
|- app.module.ts
Run Code Online (Sandbox Code Playgroud)

...示例模块的路由结构看起来像...

const routes: Routes = [
  {
    path: '',
    children: [
      {
        path: '',
        component: SampleComponent
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
}) …
Run Code Online (Sandbox Code Playgroud)

angular-module angular angular-router angular6

5
推荐指数
1
解决办法
7483
查看次数