How do you define routes?
A router must be configured with a list of route definitions. You configures the router with routes via the RouterModule.forRoot()
method, and adds the result to the AppModule's imports
array.
const appRoutes: Routes = [{ path: 'todo/:id', component: TodoDetailComponent },{path: 'todos',component: TodosListComponent,data: { title: 'Todos List' }},{ path: '',redirectTo: '/todos',pathMatch: 'full'},{ path: '**', component: PageNotFoundComponent }];@NgModule({imports: [RouterModule.forRoot(appRoutes,{ enableTracing: true } // <-- debugging purposes only)// other imports here],...})export class AppModule { }
March 06, 2022
201
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat are the steps to use animation module?
October 31, 2022
Angular