I get this runtime error with my routing when upgrading to RC6 (including child routes):
Listing Component is not part of any NgModule or module has not been imported into your module
This error indicates that I did not add ListingComponent to ngModule, but it is there as an ad.
In app.module, I have all my components as declarations. I also import the routing component. The routing component has an auxiliary routing component called listing.routes.
Here is my app.module.ts:
import {NgModule, CUSTOM_ELEMENTS_SCHEMA, ReflectiveInjector } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {FormsModule, FormBuilder} from '@angular/forms'; import { NgClass, NgStyle} from '@angular/common'; import { AppComponent } from './app.component'; import {routing} from './app.routes'; import {ListingModule} from './components/listing/listingmodule'; import {ListingComponent} from './components/listing/listing.Component'; @NgModule({ imports: [BrowserModule, routing], providers: [], declarations: [AppComponent, ListingComponent, ListingModule], bootstrap: [AppComponent] }) export class AppModule { }
Here is my app.routes.ts (which I import as routes):
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {ListingRoutes} from './components/listing/listing.routes'; import {SplashComponent} from './components/splash/splash.component'; export const appRoutingProviders: Routes = ([ { path: '', component: SplashComponent }, { path: 'login', component: SplashComponent }, ...ListingRoutes ]); export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutingProviders);
And here is my list of .routes.ts:
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {ListingModule} from './repairreturnmodule'; import {ListingComponent} from '../listing/listing.component'; export const ListingRoutes: Routes = [ { path: '', component: ListingModule, children: [ { path: 'listing', component: ListingComponent}, ] } ]; export const ListingRouting: ModuleWithProviders = RouterModule.forChild(ListingRoutes);
Did I miss something?