I’m trying to loop over a computed property array in handlebars. In this example, I can do it for an ordinary array, but not a computed array:
http://jsfiddle.net/gh7Qr/
What should the right syntax be to loop over a computed property in handlebars?
Yes, it is possible. But you forgot to
returnyour computed array and you have to addcacheable()to computed properties, which return an object and not a primitive. Otherwise you’ll run into an infinite loop (see discussion https://github.com/emberjs/ember.js/issues/38) Also have a look at Gordon Hempton’s excellent blog post about current Ember.js gotchas, among others regarding computed properties. However since commit 626d23f the issue with cacheable has been solved.A corrected example of your code is here: http://jsfiddle.net/gh7Qr/4/
Handlebars:
JavaScript: