Skip to content

Instantly share code, notes, and snippets.

@edimoldovan
Created October 18, 2012 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edimoldovan/3913623 to your computer and use it in GitHub Desktop.
Save edimoldovan/3913623 to your computer and use it in GitHub Desktop.
Computed property in handlebars template
This is the computed property, which depends on an image array, the product.images
smallImages: function() {
"use strict";
var smalls = product.images.map(function(original){
return original + "-small.png";
});
return smalls;
}.property('product.images').cacheable(),
What I need, is something like this in my template:
{{#each image in smallImages}}
<li class="small-image">
<img src="{{image}}"/>
</li>
{{/each}}
But here that computed property looks undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment