Router angolare con parametri

Esempi di codice

5
0

routing della home page in angolare

const routes: Routes = [
  { path: 'home_page_path', component: HomePageComponent }

];
add this in app routing file
/*
I Hope it will Help You.
Namaste _/\_
*/
5
0

parametri url di routing angolare

    
      const appRoutes: Routes = [
  { path: 'crisis-center/:param1', component: CrisisListComponent },
  { path: 'hero/:param2',      component: HeroDetailComponent },
];

@NgModule({
  imports: [
    RouterModule.forRoot(
      appRoutes,
      { enableTracing: true } // <-- debugging purposes only
    )
    // other imports here
  ],
  ...
})
export class AppModule { }
    
3
0

router angolare con wuery param

goProducts() {
  this.router.navigate(['/products'], { queryParams: { order: 'popular' } });
}

http://localhost:4200/products?order=popular

 constructor(private route: ActivatedRoute) { }

  ngOnInit() {
    this.route.queryParams
      .filter(params => params.order)
      .subscribe(params => {
        console.log(params); // { order: "popular" }

        this.order = params.order;
        console.log(this.order); // popular
      }
    );
  }
0
0

router params angolare

// Navigate and send Params
this.router.navigate(['/users/edit/', user.id]);

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................