How to get the query parameters in Iron-router?

前端 未结 8 1359
不知归路
不知归路 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 11:07

    iron router >= 1.0

    A route's query parameters are available as properties of this.params.query.

    If your URL looked like:

    /posts/5?sort_by=created_at
    

    then this.params.query.sort_by would equal 'created_at'.


    iron router < 1.0

    A route's query parameters are available as properties of this.params.

    If your URL looked like:

    /posts/5?sort_by=created_at
    

    then this.params.sort_by would equal 'created_at'.

提交回复
热议问题