I was wondering if it was possible to add arguments to a computed properties. So far, everything I tried resulted in errors and found nothing on the subject. I want to build a URL using a value that is not included in my model.
I'm looking for something that would look like this :
// App.js
App.Image = DS.Model.extend({
image_path_sh: DS.attr(), // image.jpg
image_size_nm: DS.attr(), // 234234
image_alt_sh: DS.attr(), // My image
image_abs_url: function(width, height) {
return "http://localhost/images/" + this.get('image_path_sh') + "/" + width "x" + height
}.property('image_path_sh')
});
// index.html
// I know this doesn't work, but I'd like to have something that easy to use
{{#each image}}
<img src="{{image_abs_url 250 250}}" alt="{{image_alt_sh}}" />
{{/each}}
My server will return an image that is resized. I don't want to put that in my database because these are not fixed value.
Ember.Handlebars.helperwill be the closest thing to it. - iConnor