The Routes is uses to describe our application's Routes. The “RouterModule.forRoot” method in the module imports to configure the router. Five concepts that need Routes Representation 1. Path (a part of the URL) 2. Route Parameters 3. Query/Matrix Parameters 4. Name outlets 5. A tree of route segments targeting outlets Syntax:- RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home/:id', component: HomeComponent }, //HERE ID IS A ROUTE PARAMETER. { path: 'login', component: LoginComponent }, { path: 'registration', component: RegistrationComponent }, ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers