[Fixed] Any advice on this angular problem? Mosh tutorial not working for me?

Issue

watching https://youtu.be/k5E2AVpwsko and made it to the 1:35:00 roughly time of adding the courses part. I ge the following error.
Failed to compile.

../src/app/app.component.html:2:1 – error NG8001: ‘courses’ is not a known element:

  1. If ‘courses’ is an Angular component, then verify that it is part of this module.
  2. To allow any element add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component.

2


../src/app/app.component.ts:5:16
  5   templateUrl: './app.component.html',
                   ~~~~~~~~~~~~~~~~~~~~~~
  Error occurs in the template of component AppComponent.

What am i missing? I tried debugging, but nothing. Any help is appreciated.

Solution

You haven’t declared courses component as part of app module. In declarations array, you need to give it. Also you could try the ng commands like ng g component courses from the app module directory in terminal, instead of creating it manually which automatically adds it to app module.

Leave a Reply

(*) Required, Your email will not be published