xxxxxxxxxx
content_copy
goToItems() {
this.router.navigate(['items'], { relativeTo: this.route });
}
xxxxxxxxxx
//app-routing.module.ts file
const routes: Routes = [
// for simple path
{
path:'admin',component:UserHomeComponent
}
//child parent context
{
path:'',component:UserSideComponent,
children:[
{
path:'home',component:UserHomeComponent
},
{
path:'checkout',component:CheckoutComponent
}]
},
]
const routes: Routes = [
{ path: 'first-component', component: FirstComponent },
{ path: 'second-component', component: SecondComponent },
{ path: '', redirectTo: '/first-component', pathMatch: 'full' }, // redirect to `first-component`
{ path: '**', component: PageNotFoundComponent }, // Wildcard route for a 404 page
];
xxxxxxxxxx
angular.io
xxxxxxxxxx
// create a new project with routing enabled
ng new routing-app --routing