I'm Using iron-ajax with iron-list and for the iron-image i need to concatenate text to the image source that has{{item.path}}
i tried this way
<iron-image style="width:80px; height:80px;" sizing="cover" src="http://mydomain/{{item.path}}.jpg" preload></iron-image>
But i get no image loaded and upon inspecting a list item it doesn't insert the path of the image coming from json data.
src="http://mydomain/{{item.path}}.jpg"
What is the way to concatenate the above
by itself src="{{item.path}}"
i see the path when i inspect an item
Thanks
String interpolation is not yet supported in Polymer 1.0. You will need to use a computed binding.
For instance:
<dom-module id="your-tag">
<template>
<iron-image
style="width:80px; height:80px;"
sizing="cover"
src$="{{_getImagePath(item.path)}}"
preload></iron-image>
</template>
<script>
Polymer({
is: "your-tag",
_getImagePath: function(url) {
return 'http://mydomain/' + url + '.jpg';
}
});
</script>
</dom-module>
I have answered a similar question here.
i think you forgot to declare item.path
you should
Polymer({ item.path: "/set/your/path"});
i think this example may solve you problem:
function(myPath) {
return 'http://mydomain/' + myPath + ".jpg";
}
then you can use in the following way:
src="http://mydomain/{{myPath(item.path)}}"
you may also look here for further investigation and more comprehensive examples.