Why bind-attr src for my img added my hostname to src attr?


#1

My model is store, and store.src means the actual image url, and in my template I wrote:

<img src={{bind-attr store.src}} />

I logged store.src to the console and it prints the correct image url without my hostname as a prefix, but in the page the actual image url became the hostname + store.src. For example, the value of store.src is: /1.2.3.4/1.jpg, but in the page, 's src became:http://localhost:8888/1.2.3.4/1.jpg Why does this happen? How could I solve this problem? Thank you


#2

This question is better left to stackoverflow, but I’ll answer it before it’s pretty clear what the problem is.

<img {{bind-attr src=store.src}} />

http://emberjs.com/guides/templates/binding-element-attributes/


#3

I found the problem. Because the src attr in store is without ‘http://’ prefix so my hostname is added. Thanks all the same:)