Angular 2 applications require to redirect route and pathMatch is a property which informs a router how to match and map a URL to the path of an actual route. In the application, the router automatically select the route using component HeroListComponent only when the entire URL of matches for example-

const appRoutes: Routes = [
   { path: 'crisis-center', component: CrisisListComponent },
   { path: 'heroes', component: HeroListComponent },
   { path: '', redirectTo: '/heroes', pathMatch: 'full' },
   { path: '**', component: PageNotFoundComponent }
];

Suggest An Answer

No suggestions Available!