app is not a known element angular error 1

app is not a known element angular error

I created a home component that I could not render and kept getting the same error. Here is how I solved it.

I checked the app.module.ts file to see if the component was imported and added to @NgModule declarations. Since it wasn't I added the following:

    import { HomeComponent } from './home/home.component';

    declarations: [

I'm not sure why it wasn't added when the CLI generated the component but this is was my solution. Let me know if it worked for you or what you ended up finding as a solution.

Here is what the above code is Doing:
1. We import the HomeComponent from the home folder.
2. We add the HomeComponent to the @NgModule declarations.

Similar Posts