How can I find the error of the following error report?
GET http://localhost:8080/img/%7B%7BCurrentPage.img%7D%7D 404 (Not Found) angular.js:2763
r.html ang
This error happens when you use img
with src
attribute instead of ngSrc. You should use this notation:
The problem is that when you use src="{{CurrentPage.img}}"
syntax, browser starts downloading a resource making an HTTP request before Angular resolves binding and replace {{CurrentPage.img}}
with actual image path:
http://localhost:8080/img/%7B%7BCurrentPage.img%7D%7D
(urlencoded {{CurrentPage.img}}
). Obviously it will result in a 404 error.
On the other hand, ng-src
attribute doesn't mean anything to browser so it won't do anything, until Angular is ready and ngSrc directive creates src
attribute with proper URL.