需要帮助:Angular路由器和导航项目不起作用

问题描述 投票:0回答:1

我试图从下面的站点使用Angular Routes教程创建项目。

https://www.codingame.com/playgrounds/8104/angular-router-tutorial

当我运行项目时,在VS Code终端窗口中出现以下错误消息。

ERROR in Cannot read property 'loadChildren' of null

在加载本地主机窗口后,在加载页面中收到错误消息“ Cannot GET /”。

Cannot GET message as displaying in loading page

我没有在我的项目中使用loadChildren概念。但我有错误。我更新了app.module.ts和routerConfig.ts文件实现的代码更改的屏幕截图。

app.module.ts file

routerConfig.ts file

请让我明白。我错过了什么?在此先感谢

angular visual-studio-code angular-router
1个回答
0
投票

添加

  {
    path: '',
    redirectTo: '/home',
    pathMatch: 'full'
  }

到您的路线列表

© www.soinside.com 2019 - 2024. All rights reserved.