How to get the query parameters in Iron-router?

前端 未结 8 1339
不知归路
不知归路 2020-12-13 10:24

I am trying to get the query parameters in the url.

There doesn\'t seem to be an easy way to do this...

which leaves me with the feeling that I must have mis

8条回答
  •  执笔经年
    2020-12-13 10:56

    You can pass queries like this depending on where you accessing the router:

    In the template

    {{pathFor 'routeName' query='queryName=queryValue'}}
    

    In the helper

    Router.go ('routeName',{},{query: 'queryName=queryValue'}
    

    Note: the empty object between the routeName and the query is if you want to specify any parameters (refer to the full docs to see the difference).

    If you would like to pass multiple queries do it like this:

    query: 'queryName1=queryValue&queryName2=queryValue'
    

    Don't use spaces and remember to use the & sign.

提交回复
热议问题