1

I'm currently having trouble to display my picture using ng-src.

<img ng-src="http://localhost:3000/images/{{image.image}}" class="img-circle" alt="User" style="width: 130px; height: auto;">

The data is there when I console log this

$scope.image = products.userinfo[products.index];

I didn't get any errors. Here is the sample output that I get. enter image description here

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
  • Can you try this? http://stackoverflow.com/a/18235271/5244968 Also please make sure the image actually exists on that URL :) – smddzcy May 16 '17 at 22:09

2 Answers2

2

Try this

<img ng-src="{{'http://localhost:3000/images/' + image.image}}">
rastemoh
  • 438
  • 3
  • 10
0

It should be just image,

<img ng-src="http://localhost:3000/images/{{image.image}}"

and then ,

$scope.image = products.userinfo[products.index].image;
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Hi, I've tried that before but didn't work. Infact it give an error. Here's my situation, every time I go into the page, the image displayed, but when I reload the page, the image disappear. – Azinuddin AleleCha May 17 '17 at 04:15
  • probably its not getting assigned when you refload. – Sajeetharan May 17 '17 at 04:18
  • Hi @AzinuddinAleleCha since you are storing your image in scope variable you are losing it on refresh. Try to use localstorage to store image instead! – SAN May 17 '17 at 05:06