How to append string to bound img src?


#1

Hi,

I currently have an image that uses an url that is built from several parts. One part is from the model and another is appended such as “_large.jpg”. If I make the model data unbound this works but not if it’s bound. How could I solve this?

<img src="/photos/user/{{imageHash}}_large.jpg" alt="">

I also found this related topic: https://github.com/emberjs/ember.js/issues/507

Thanks!


#2

Use the bind-attr helper. You can do the string concatenation in a computed property on the controller or model.


#3

Thanks that worked like a charm :slight_smile: