jeudi 11 février 2016

Ember js link-to dynamic query param

i will explain it with example

{{#link-to item.targetUrl (query-params randomParam=value.id) class="link-wrap"}}abc{{/link-to}}

if targeturl is abc.xyz this will give me href="#/abc/xyz?randomParam=2"

How to have a dynamic param??? randomParam is not going to be same, it might be randomParm1 or randamParm2 so i want something like below:

{{#each selectedTab.content as |item|}}

      {{#each item.values as |value|}}
      <li {{action 'itemSelect' item.targetUrl item.param }}>{{#link-to item.targetUrl (query-params item.param=value.id) class="link-wrap"}}{{value.desc}}{{/link-to}}</li>
      {{/each}}

  {{/each}}

here item.param is dyanamic. I am not really looking for work arounds since i figured out a solution using this.transitionTo from an action in template. I am looking for how to solve this in {{link-to}} helper.




Aucun commentaire:

Enregistrer un commentaire