title: Component is not part of any NgModule or the module has not been imported into your module
body: <p>I am building an angular 4 application. I am getting error</p>
  
  <pre><code>Error:Component HomeComponent is not part of any NgModule or the module has not been imported into your module.
  </code></pre>
  
  <p>I have created HomeModule and HomeComponent. Which one do I need to refer to the AppModule? I am a bit confused. Do I need to refer HomeModule or HomeComponent? Ultimately what I am looking for is when the user clicks the Home menu, he should be directed to the home.component.html which will be rendered on the index page.</p>
  
  <p>App.module is:</p>
  
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { FormsModule } from '@angular/forms';
  import { HttpModule } from '@angular/http'
  
  import { AppComponent } from './app.component';
  import { NavbarComponent } from './navbar/navbar.component';
  import { TopbarComponent } from './topbar/topbar.component';
  import { FooterbarComponent } from './footerbar/footerbar.component';
  import { MRDBGlobalConstants } from './shared/mrdb.global.constants';
  import { AppRoutingModule } from './app.routing';
  import { HomeModule } from './Home/home.module';
  
  @NgModule({
    declarations: [
      AppComponent,
      FooterbarComponent,
      TopbarComponent,
      NavbarComponent
  
    ],
    imports: [
      BrowserModule,
      HttpModule,
      AppRoutingModule,
      HomeModule
  
    ],
    providers: [MRDBGlobalConstants],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  </code></pre>
  
  <p>HomeModule is:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { HomeComponent } from './home.component';
  
  @NgModule({
    imports: [
      CommonModule
    ],
    exports: [HomeComponent],
    declarations: [HomeComponent]
  })
  export class HomeModule { }
  </code></pre>
  
  <p>HomeComponent is:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  @Component({
    selector: 'app-home',
    templateUrl: './home.component.html',
    styleUrls: ['./home.component.css']
  })
  export class HomeComponent implements OnInit {
  
    constructor() { }
  
    ngOnInit() {
    }
  
  }
  </code></pre>