After updating to angular 2 RC5, I was receiving warnings instructing me to relocate my components to module declarations:
The NgModule AppModule is using AcademylistComponent via "entryComponents" but it was not declared or imported! This warning will turn into an error in the final version.
In my router configuration file, I referenced these components. The original setup looked like this:
import {provideRouter,RouterConfig} from '@angular/router';
import {AcademylistComponent} from '../modules/home/component/academyList.component';
import {CourselistComponent} from '../modules/home/component/courseList.component';
import {CreateacademyComponent} from '../modules/home/component/createAcademy.component';
import {ReportsComponent} from '../modules/home/component/reports.component';
import {AuthenticatedGuard} from '../guards/authenticated.guard';
export const routes: RouterConfig = [
{
path: '',
redirectTo:'/home',
terminal:true},
{
path: 'home',
canActivate: [AuthenticatedGuard],
children: [
{path: '', component: AcademylistComponent},
{path: 'my-academies', component: AcademylistComponent},
{path: 'my-courses', component: CourselistComponent},
{path: 'create-academy', component: CreateacademyComponent},
{path: 'reports', component: ReportsComponent}
]
}
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
When I moved the components to the ng module's declarations
array and imported them there, the routes config file started showing me Cannot find name
errors.
How can I properly utilize module declarations in this scenario?