Reputation: 28126
I need to have knockout create the image src for me, but I only have one part of the image location. I am using an items ID as the image names. Works
<img alt="" data-bind="attr: {src: $data.img}">
Needed
<img alt="" data-bind="attr: {src: /img/clients/$data.img.jpg}">
Upvotes: 1
Views: 501
Reputation: 732
perhaps try this:
<img alt="" data-bind="attr: {src: '/img/clients/' + $data.img + '.jpg'}">
Upvotes: 3