mercredi 16 septembre 2015

Ember Handlerbars @ how to get child index?

@index, index is not working inside templates. I dont know exactly. Therefore, I have moved to {{_view.contentIndex}} for getting index value. But how to get child index ?.

Question No 1:

Let say, I have two dicts

first_dict = [{"name":"x"},{"name":"y"},{"name":"z"}]
second_dict = [{"name":"x"},{"name":"y"}]

{{#each first in first_dict}}
   {{_view.contentIndex}} # output 0,1,2

    {{#each second in second_dict}}
      ???how to get second_dict index here ??
    {{/each}}
{{/each}}

Question No 2:

How to access second_dict values via parent index ?

{{#each first in first_dict}}
   {{_view.contentIndex}} 
   ???{{second_dict._view.contentIndex.name}} # how to access second dict value based on parent index ?
{{/each}}




Aucun commentaire:

Enregistrer un commentaire