Angular 6 : How to setup routing app-routing navigate to sub project app-routing

Active3 hr before
Viewed126 times

6 Answers


How to define paths relative to the current path or the root of the application,, How to define paths relative to the current path or the root of the application

Example_snippet/controller/utility/_navigate.js/ @Component({ selector: 'app-. . .
  selector: 'app-artist',
  template: `
class ArtistComponent {
load more v

Routing in Feature Module,Example AppCreating the Feature ModuleRouting ModuleRoot ModuleChild RoutesMenu in  Feature Module,Creating the Feature ModuleRouting ModuleRoot Module,In this module, we learnt how to define routes in feature modules, We also looked at how to add child routes and wild card routes

Example_snippet/controller/utility/_navigate.js/ path. . .
Step 2 continued with component. . .
Step 3 continued with HomeComponent . . .
Step 4 continued with “/home”. . .
load more v

We import the Resolve interface from the @angular/router package,,We import the Routes and RouterModule symbols from the @angular/router package which is the central repository that holds all the Router APIs

Example_snippet/controller/utility/_navigate.js/ { path: 'my/path/', component:. . .
   path: 'my/path/',
   component: MyComponent
load more v

Creating routes with parameters is a common feature in web apps, Angular Router allows you to access parameters in different ways:,In most cases, you’ll use the Angular CLI to create projects with routing setup but in this case, we’ll add it manually so we can get a better idea how routing works in Angular

Example_snippet/controller/utility/_navigate.js/ { path: 'contacts',pathMatch:. . .
   path: 'contacts',
   pathMatch: 'prefix',
   component: ContactListComponent
load more v

RouterModule,forRoot(),You configured the router in an AppRoutingModule,First, the app-routing

Example_snippet/controller/utility/_navigate.js/ content_copy . . .

      ng generate module app - routing--flat--module = app
load more v

How to setup routing app-routing,module

Example_snippet/controller/utility/_project.js/ my-app/ src/ app/ . . .
my - app /
   src /
   app /
   app - routing.module.ts
   projects /
   my - sub - app /
   src /
   app /
   app - routing.module.ts
load more v