fr
fr

Question from the Angular test

Get a path parameter from the current url in Angular

Easy

How can we get a path parameter named id from the current url?

Author: Emmanuel DemeyStatus: PublishedQuestion passed 3096 times
Edit
5
Community Evaluations
developer avatar
Lucas Garcia
30/05/2023
Inutile de connaître ça par cœur ! Et désormais nous pouvons récupérer les path params, query params, data et resolvers en @Input directement
developer avatar
Vincent Cotro
05/06/2023
Bonjour Lucas, je ne suis pas sur que @Input permette de récupérer les path ou query params, aurais-tu un exemple ?
developer avatar
Lucas Garcia
05/06/2023
Si mais ça vient de sortir en version 16 https://itnext.io/bind-route-info-to-component-inputs-new-router-feature-1d747e559dc4
developer avatar
No
26/06/2024
NW :@Component({ ... }) export class AppComponent { constructor(private route: ActivatedRoute) { const id = route.snapshot.paramMap.get('id'); } }