Angular 2 : No NgModule metadata found

后端 未结 28 1500
盖世英雄少女心
盖世英雄少女心 2020-11-30 05:31

I\'m brand new to Angular 2 and attempting to follow along with a video tutorial I found. Despite following all of the steps, Angular just won\'t work; I get the following e

28条回答
  •  旧巷少年郎
    2020-11-30 06:10

    I've encountered this problem twice now. Both times were problems with how I was implementing my lazy loading. In my routing module I had my routes defines as:

      {
        path: "game",
        loadChildren: () => import("./game/game.module").then(m => {m.GameModule})
      }
    

    But this is wrong. After the second => you don't need curly braces. it should look like this:

      {
        path: "game",
        loadChildren: () => import("./game/game.module").then(m => m.GameModule)
     }
    

提交回复
热议问题