How to get the query parameters in Iron-router?

前端 未结 8 1335
不知归路
不知归路 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'.

    0 讨论(0)
  • 2020-12-13 11:10

    Just call

    Router.current().params //params is the dict you wanted

    in Iron Router 7.1+

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