Harsh Gupta
Harsh Gupta

Reputation: 1

Access parameters from URL using Angular

I want to access the parameters from url in Angular 2. I use ActivatedRoute service instance which has the property of Params, Params has the property _value which has the parameters but when tried to access it in Visual Code couldn't why is that ?

enter image description here

Upvotes: 0

Views: 159

Answers (1)

Ramesh Rajendran
Ramesh Rajendran

Reputation: 38713

Please take a look here and try this below.

this.activatedRoute.params.subscribe(params => {
this.id = params['id']; //Assume id is your parameter name                    
});

Upvotes: 1

Related Questions