import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { SearchComponent } from './search/search.component' ; import { EditComponent } from './edit/edit.component' ; const routes = [ { path : 'search' , component : SearchComponent } , { path : 'edit/:id' , component : EditComponent } , { path : '' , redirectTo : '/search' , pathMatch : 'full' } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }