AngularJS use two way data binding to display image in img element tag as source?

Wes picture Wes · Nov 1, 2013 · Viewed 13.2k times · Source

I am making a http request that returns a url to an image. I would like to display the image in my html page. Is there a way to do this? I idea of what I want to do is (this doesn't work but..) img src={{result.imageurl}}

Answer

NicolasMoise picture NicolasMoise · Nov 1, 2013

Yes, you have to use ng-src="{{result.imageurl}}"

See http://docs.angularjs.org/api/ng.directive:ngSrc