简体   繁体   中英

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

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.

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.

You should delete the app component and use ng generate component courses.It will automatically add the component to your app module. It is easy and handy. You can also watch documentation of angular component which will be much helpful for your development

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM