Routing

Angular routing allows navigation between different views in an Angular application.

Snippet:

const routes: Routes = [ { path: "home", component: HomeComponent }, { path: "about", component: AboutComponent } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule {}

Example:

const routes: Routes = [ { path: "", redirectTo: "/dashboard", pathMatch: "full" }, { path: "dashboard", component: DashboardComponent } ];