Angular 2 throwing error: Outlet is not activated

后端 未结 4 1158
我寻月下人不归
我寻月下人不归 2021-02-12 22:21

I have set up my app so that I have a Recipe Book which has a list of Recipies which when I click on a Recipe it then shows the Recipe Details

4条回答
  •  故里飘歌
    2021-02-12 23:04

    This might help someone else.

    I was getting this error. I have checked all my defined routes in my route file, the path and components are defined correctly.

    The reason of getting this error was that I forgot to add reference of my service in app.module.ts which was being used in one of my component to get data from RestApi.

    So, always add service reference in app.module.ts in providers section, immediately after creating service.

    imports: [
       BrowserModule,
       HttpModule,
       ......
     ],
    
    providers: [
        AuthService, 
        ........ // Here, service reference
    ]
    

提交回复
热议问题