I have implemented ActivatedRoute on my app.component.ts page. This is the page where I have a big, red exit button on, and it appears on all pages of my app as intended.
I jump into the url I've created (with a query string) as follows:
http://localhost:4200/status?returnString=xyz
I have a private route: ActivatedRoute
within my constructor. In my ngOnInit()
function I have console.log(this.route.queryParams);
. And that returns an object where the ._value
is an object with a property of returnString: "xyz"
as intended.
The problem is, when I console.log(this.route.queryParams.returnString)
or console.log(this.route.queryParams._value)
I am being served an object with no properties. {}
.
My question is, what happened or moreover, what am I doing wrong? What will it take for me to get a parameter from the URL that I can consume in Angular 5?