jBenes / angular-imgcache.js

Simple imgcache.js wrapper for AngularJS
MIT License
83 stars 42 forks source link

It's not working #6

Open tiagoporto opened 9 years ago

tiagoporto commented 9 years ago

Hello, I'm using with ionic.

I think I'm doing all right however seems not working.

I'm link the files

<script src="js/ionic.bundle.min.js"></script>
<script src="js/imgcache.js"></script>
<script src="js/angular-imgcache.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>

In the file app.js I init the imgcache

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ImgCache'])

.run(function($ionicPlatform, ImgCache) {
    $ionicPlatform.ready(function() {
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }

        ImgCache.$init();
    });
})

.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider, ImgCacheProvider) {
    ImgCacheProvider.manualInit = true;
...
});

And in the templates I'm using

<img img-cache ic-src="http://site/{{ PhotoApp) }}" ng-src="http://site/{{ PhotoApp }}" alt="{{ Name }}">

Checking the cache size the images appear cached.

But after a while accessing the app offline the images don't work.

I forgot something?

tiagoporto commented 9 years ago

Now I removed the ng-src in the tag, and is working on chrome. But when I get the build with phonegap the images aren't displayed.

<img img-cache ic-src="http://site/{{ PhotoApp) }}" alt="{{ Name }}">
han4wluc commented 9 years ago

Were you able to solve this? I'm having the same problem. It's working on the browser but not on a device.

EDIT: I was able to solve it by using this: https://github.com/chrisben/imgcache.js/pull/96/files

jeffthompson1971 commented 8 years ago

Anyone know of a platform indepenent way? this sucks cuz I got it all working only later to find that it doesn't work on cordova IOS (ionic app) or safari. How is THAT a solution ?