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:

  1. "assertion failed: value #each loops on must array. passed [object object]"
  2. 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:

  1. creating custom handlebars {{#each}} helper deals non ember.object's
  2. parse data coming backend , convert locator_map objects ember.object's make objects binding aware etc.

see answer answered deals similar case.

hope helps.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -