przemoW
przemoW

Reputation: 127

Get Error 403 Image Angular

Server response to me document(in Json) with information. And in this json i have a url to image. And every time when i load new content of page( with new image) it appear but in console have error:

enter image description here

I use url from json in angular to display image on my website.

More info from fiddler: enter image description here

Screen in chrome loaded image: enter image description here

Help me to solve this problem.

Upvotes: 2

Views: 2520

Answers (2)

Felix Tjandrawibawa
Felix Tjandrawibawa

Reputation: 492

You need to use ng-src to prevent the browser from fetching the image before the {{content.imageURL}} resolved by Angular.

More information from ng-src docs: http://docs.angularjs.org/api/ng.directive:ngSrc

Upvotes: 1

Chandermani
Chandermani

Reputation: 42669

Instead of src attribute Set ng-src in your html markup whereever you are binding the url to json response. Something like

<img ng-src="{{content.imageUrl}}"/>

Using src causes browser to make a request before binding is resolved.

More details here

Upvotes: 4

Related Questions