ember.js - Walking an object in a template -
one of data models has data structure:
properties : { .... locator_map : { locator1 : locator_doc_id1, locator2 : locator_doc_id2, ... locatorn : locator_doc_idn, }, ... } in template want provide links documents, not know how walk object locator_map. want on these lines:
{{#each locator in this.properties.locator_map}} {{#linkto "locators.show" this.properties.locator_map[locator]}}locator{{/linkto}} {{/each}} but have 2 problems:
- "assertion failed: value #each loops on must array. passed [object object]"
- how access value? have impression
this.properties.locator_map[locator]not going work.
any idea how walk object?
the reason why not working because in ember framework extends ember.object locator's not, have 2 options:
- creating custom handlebars
{{#each}}helper deals nonember.object's - parse data coming backend , convert
locator_mapobjectsember.object's make objects binding aware etc.
see answer answered deals similar case.
hope helps.
Comments
Post a Comment