Skip to content

Using #each and queryParamRaw when there's only a single queryParam #1259

Answered by 255kb
jtaylordigital asked this question in Help
Discussion options

You must be logged in to vote

Hi, there is no easy solution as the default behavior of the server we are using is to parse single query parameters as strings or as arrays when multiple occurences are found.
However, you could handle this a bit differently to simplify your code after, using split/join and a variable:

{{setVar 'ids' (split (join (queryParamRaw 'id') ',') ',')}}

{
  {{#each @ids}}
    "id": {{this}}
  {{/each}}
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jtaylordigital
Comment options

Answer selected by jtaylordigital
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants