dimanche 4 janvier 2015

How do you add the "each in" to work in handlebars

Ember is migrating to a non-context switching #each helper. For a compatibility piece I need to do the same from raw handlebars.


However the trivial attempt fails



var f = Handlebars.compile("{{#each numbers}}{{this}}{{/each}}");
console.log(f({numbers: [1,2,3]}));
// works

var f2 = Handlebars.compile("{{#each number in numbers}}{{number}}{{/each}}");
console.log(f2({numbers: [1,2,3]}));
// fails


How do I get {{each number in numbers}} to work in raw handlebars 2.0?





Aucun commentaire:

Enregistrer un commentaire