Cannot get query Params on routerOnActivate

后端 未结 1 1132
一个人的身影
一个人的身影 2021-01-25 18:05

Im having problems trying to get query params using the new Route library.

VERSION 2.0.0-rc.1

Problem

routerOnA         


        
1条回答
  •  野的像风
    2021-01-25 18:36

    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

    0 讨论(0)
提交回复
热议问题