Reputation: 7
Hi i'm new to angular 17, i'm following the course tour of heroes on the website.
After creating the project, i create a new component heroes just like the tutorial tells me to.
I add the component selector to app.component.html like this :
<app-heroes></app-heroes>
As i am trying to serve the project i have this error :
[ERROR] NG8001: 'app-heroes' is not a known element:
If 'app-heroes' is an Angular component, then verify that it is included in the '@Component.imports' of this component.
If 'app-heroes' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message. [plugin angular-compiler]
src/app/app.component.html:0:0: 0 │ ╵ ^
Error occurs in the template of component AppComponent.
src/app/app.component.ts:9:15:
9 │ templateUrl: './app.component.html',
Can someone help please ??
I tried to do ng serve --open and want it to serve in my browser but it's not working.
Upvotes: 0
Views: 604
Reputation: 7
I found the answer. I had to import the component in app.component.ts like this :
import { HeroesComponent } from './heroes/heroes.component';
and also add it in the @Component.imports in the same file.
Upvotes: 1