-
Notifications
You must be signed in to change notification settings - Fork 41
Loading image from 127.0.0.1 works with imgcache.js but not with angular-imgcache.js #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm using ionic. I followed the instruction to config in the angular config section and calling $init() in the run section. I also looked at the source code (https://github.com/jBenes/angular-imgcache.js/blob/master/angular-imgcache.js#L69) and the code is doing the right thing. In fact, when I test without using the directive, it worked. So I can't quite figure out how a directive would be different from calling the API directly. Very baffling. |
Hi, @5amfung |
No, I did not figure it out. |
Don't know why it works one way but not another, however a work around for browser is to install this plug in: https://chrome.google.com/webstore/detail/cors-toggle/omcncfnpmcabckcddookmnajignpffnh?hl=en |
+1 |
I submitted PR #24 as a workaround for this issue. In the case cross-domain policy prevents from loading image, this change provides a fallback behavior that consists in displaying directly pictures without caching them (in my use case it is better than a broken image). |
I was able to load and cache the image file using
ImgCache.cacheFile()
from imgcache.js. However, when I switch to using theimg-cache
directive like<img img-cache ic-src="{{ img_url }}">
, I always got the XHR error like the following.The text was updated successfully, but these errors were encountered: