Angular 4 - Routes - How to create a separate module for managing routes and use it in app.module.ts file
I am newbie in Angular, I want to implement the routes in separate component and import the same component in app.module.ts file. How do I import the routes component in app.module.ts file. I was trying like: app.routes.ts import { UsersComponent } from './users/users.component'; export class AppRoutes { getRoutes() { return [ { path: 'users', component: UsersComponent } ]; } } in app.modules.ts import { AppRoutes } from './app.routes'; @NgModule({ declarations: [ AppComponent, UsersComponent, ], imports: [ BrowserModule, HttpModule, HttpClientModule, RouterModule.forRoot(AppRoutes.getRoutes()