import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { ProductDetailsComponent } from './product-details/product-details.component' ; import { ProductListComponent } from './product-list/product-list.component' ; const routes = [ { path : '' , component : ProductListComponent } , { path : 'products/:productId' , component : ProductDetailsComponent } ] ; @ NgModule ( { imports : [ RouterModule . forChild ( routes ) ] , exports : [ RouterModule ] } ) export class ProductsRoutingModule { }