title: angular 2 routing throwing error even I have entry in @NgModule of app.module.ts
body: <p>I have implemented angular 2 routing but it's throwing error as </p>
  
  <blockquote>
    <p>Uncaught (in promise): Error: No component factory found for
    AdminpanelComponent. Did you add it to @NgModule.entryComponents?</p>
  </blockquote>
  
  <p>Even though I have entry in app.module entryComponents still I am facing this errro. Details of code below.</p>
  
  <p><strong>app.routes.ts</strong></p>
  
  <pre><code>import {provideRouter, RouterConfig} from '@angular/router';
  import { AdminpanelComponent } from './components/adminpanel/adminpanel.component';
  import { LoginComponent } from './components/login/login.component';
  
  export const AppRoutes: any = [
      { path: '', component: 'LoginComponent'},
      { path: 'login', component: LoginComponent },
      { path: 'admin', component: AdminpanelComponent },
      { path: '**', component: LoginComponent }
  ];
  
  export const AppComponents: any = [
      LoginComponent,
      AdminpanelComponent
  ];
  </code></pre>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code> import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { HttpModule } from '@angular/http';
  import { AuthService} from './services/auth.service'
  
  import { AppComponent } from './app.component';
  import { NavbarComponent } from './components/navbar/navbar.component';
  import { AdminpanelComponent } from './components/adminpanel/adminpanel.component';
  import { BalldetailsComponent } from './components/balldetails/balldetails.component';
  import { LoginComponent } from './components/login/login.component';
  
  import { RouterModule } from "@angular/router";
  import { AppComponents, AppRoutes } from "./app.routes";
  
  
  @NgModule({
    declarations: [
      AppComponent,
      AppComponents,
      NavbarComponent,
      AdminpanelComponent,
      BalldetailsComponent,
      LoginComponent
    ],
    imports: [
      BrowserModule,
      HttpModule,
      RouterModule,
      RouterModule.forRoot(AppRoutes)
    ],
    providers: [AuthService],
    bootstrap: [AppComponent],
    entryComponents: [
      AppComponent,
      AppComponents,
      NavbarComponent,
      AdminpanelComponent,
      BalldetailsComponent,
      LoginComponent
    ]
  })
  export class AppModule { }
  </code></pre>
  
  <p><strong>app.component.html</strong></p>
  
  <pre><code>&lt;router-outlet&gt;&lt;/router-outlet&gt;
  </code></pre>
  
  <p>Any help would be highly appreciated...Thanks</p>