Mohan Gopi Mohan Gopi - 1 year ago 65
AngularJS Question

How to store an image url received from server to variable in angular js and ionic

I am trying to get my image url from response object and store it in a variable here is my code for getting the image url from server

$scope.img = response.FacilityImage;

Here is my response for the above post method.

Here is my html where i am planing to display image

<div >
<img ng-src="{{img}}">


I am able to store or view my log for any field from response except FacilityImage field.

some how if i am able to store the image into $scope.img then using two way data binding will be able to show my image in html page

if there is any other way to make access of that image url form FacilityImage please let me know how to show that image to my view.

Answer Source

FacilityImage is an attribute of facility, therefore you have to access it like this:


Hope this helps!

UPDATE: actually event a level deeper, as facility is an array with multiple facilities, so assuming you pick the first one: