handlebars.js - How to write a boundHelper to iterate a map in Ember.js -


i have model contains ember.map, , want render content of map in template.

i've tried using custom bound helper below, template not re-render values added/removed map.

essentially want replicate behaviour of {{#each}} map.

ember.handlebars.registerboundhelper('eachinmap', function(map, block) {   out = "";   map.foreach(function(k,v) {     out += block.fn(v)   });   return new handlebars.safestring(out); }, /* dependencies put here? */); 

invoked template

{{#eachinmap mymap}} foo bar {{/eachinmap}} 

check out https://github.com/emberjs/ember.js/pull/2659. basically, boundhelpers don't support blocks sorry.

the current workaround create non-bound helper , wrap in {{#bind}} block.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -