खोज…


उप मार्गों के पेड़ के साथ मूल मार्ग उदाहरण

app.module.ts

 import {routes} from "./app.routes";

 @NgModule({
    declarations: [AppComponent],
    imports: [BrowserModule, mainModule.forRoot(), RouterModule.forRoot(routes)],
    providers: [],
    bootstrap: [AppComponent]
 })

 export class AppModule { } 

app.routes.ts

import { Routes } from '@angular/router';
import {SubTreeRoutes} from "./subTree/subTreeRoutes.routes";

export const routes: Routes = [
  ...SubTreeRoutes,
  { path: '',  redirectTo: 'home', pathMatch: 'full'}
];

subTreeRoutes.ts

import {Route} from '@angular/router';
import {exampleComponent} from "./example.component";

export const SubTreeRoutes: Route[] = [
  {
    path: 'subTree',
    children: [
      {path: '',component: exampleComponent}
    ]
  }
];


Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow