Cannot Get Query Params On Routeronactivate
Im having problems trying to get query params using the new Route library. VERSION 2.0.0-rc.1 Problem routerOnActivate(curr:RouteSegment, prev?:RouteSegment, currTree?:RouteTree, p
Solution 1:
Your code looks good, the only problem is that as per official Angular 2 documentation:
The query string parameters are no longer separated by "?" and "&". They are separated by semicolons (;) This is matrix URL notation — something we may not have seen before. Matrix URL notation is an idea first floated in a 1996 proposal and although it never made it into the HTML standard, it is legal and it became popular among browser routing systems as a way to isolate parameters belonging to parent and child routes. The Angular Component Router is such a system.
So you can get the value of optional parameter (test) from current RouteSegment by change your address from
localhost:3000/?test=helloworld
to
localhost:3000/;test=helloworld
Post a Comment for "Cannot Get Query Params On Routeronactivate"