Prometheus
Prometheus

Reputation: 33625

AngularJS will not render scope inside img tab

Why is AngularJS not rendering one of my scope variables correct when it placed inside an <img src=

For example: this renders without any problems:

{{badge.image}}

outputs = /images/test.png

but this does not:

 <img src='{{badge.image}}' />

outputs = %7B%7Bbadge.image%7D%7D

whats going on here?

Upvotes: 0

Views: 45

Answers (2)

t0mpl
t0mpl

Reputation: 5025

you have to use

<img ng-src='{{badge.image}}' />

Upvotes: 2

lukiffer
lukiffer

Reputation: 11313

You should use ng-src instead:

<img ng-src="{{badge.image}}" />

Upvotes: 2

Related Questions