mercredi 30 septembre 2015

Passing an array as a query parameter to the link-to helper

I have a queryParam in my controller that is an array like so:

export default Ember.Controller.extend({
  queryParams: ['customFilters'],
  customFilters: []  

  // Other code goes here
}

Now I want to link to this controller and provide one or many values to the customFilters queryParam as an array like so:

{{#link-to 'search' (query-params customFilters=['selection1'])}}
  Custom Selection
{{/link-to}}

Unfortunately the link-to helper doesn't seem to allow me to do that and just gives me a link to the search route with no query parameters. So I have two questions.

1) Is this something that I should be able to do? 2) Can I use the link-to helper to generate the link for me or should I try and hand roll it?




Aucun commentaire:

Enregistrer un commentaire