Code Monkey home page Code Monkey logo

ng-image-cache's Introduction

Angular image cache module

GETTING STARTED

angular
  .module('demo', [
    'ngImageCache'
  ])
;
<ui-image ui-src="'http://localhost/images/test.png'" ui-title="'Test'"></ui-image>

Image is loaded using javascript, content is stored in DOMStorage (sessionStorage or localStorage) for next loading

CONFIGURE

Update storage

angular
  .module('demo', [
    'ngImageCache'
  ])
  .config(['ImageCacheProvider', function(ImageCacheProvider) {
    // Use localStorage instead of sessionStorage
    ImageCacheProvider.setStorage(window.localStorage)
  }])
;

ng-image-cache's People

Contributors

ghoullier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ng-image-cache's Issues

Error Can't interpolate: in Ionic/Cordova App - Browserify

My View

<ion-list ng-if="news.length > 0">
            <ion-item ng-repeat="item in news | limitTo:limit" class="item item-thumbnail-left" href="#/mkf/news/{{item.id}}">
                <ui-image data-src="{{item.image}}"></ui-image>
                <h2>{{item.name}}</h2>
                <p>{{item.summary}}</p>
            </ion-item>
        </ion-list>

Call Stack

Error: [$interpolate:interr] Can't interpolate: {{item.image}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: http://server.com/files/images/thumb/100_100/1456496497_486975a6fb.jpg
at ionic.bundle.js:13380
    at Function.$interpolateMinErr.interr (ionic.bundle.js:23899)
    at parseStringifyInterceptor (ionic.bundle.js:24199)
    at Array.regularInterceptedExpression (ionic.bundle.js:27540)
    at interpolationFn (ionic.bundle.js:24169)
    at attrInterpolatePreLinkFn (ionic.bundle.js:21845)
    at invokeLinkFn (ionic.bundle.js:21962)
    at nodeLinkFn (ionic.bundle.js:21441)
    at compositeLinkFn (ionic.bundle.js:20853)
    at nodeLinkFn (ionic.bundle.js:21457)(anonymous function) @ ionic.bundle.js:25642(anonymous function) @ ionic.bundle.js:22421parseStringifyInterceptor @ ionic.bundle.js:24199regularInterceptedExpression @ ionic.bundle.js:27540interpolationFn @ ionic.bundle.js:24169attrInterpolatePreLinkFn @ ionic.bundle.js:21845invokeLinkFn @ ionic.bundle.js:21962nodeLinkFn @ ionic.bundle.js:21441compositeLinkFn @ ionic.bundle.js:20853nodeLinkFn @ ionic.bundle.js:21457compositeLinkFn @ ionic.bundle.js:20853nodeLinkFn @ ionic.bundle.js:21457compositeLinkFn @ ionic.bundle.js:20853publicLinkFn @ ionic.bundle.js:20728boundTranscludeFn @ ionic.bundle.js:20872controllersBoundTransclude @ ionic.bundle.js:21489ngRepeatAction @ ionic.bundle.js:40504$watchCollectionAction @ ionic.bundle.js:28860Scope.$digest @ ionic.bundle.js:28995Scope.$apply @ ionic.bundle.js:29263(anonymous function) @ ionic.bundle.js:31030completeOutstandingRequest @ ionic.bundle.js:18706(anonymous function) @ ionic.bundle.js:18978
ionic.bundle.js:25642 Error: [$interpolate:interr] Can't interpolate: {{notice.image}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: http://mkf-development.s3-website-us-east-1.amazonaws.com/itambe.vf.dev.phd…/files/images/content/contentImage/thumb/100_100/1456496622_a5172febb2.jpg
http://errors.angularjs.org/1.4.3/$sce/insecurl?p0=http%3A%2F%2Fmkf-develop…ges%2Fcontent%2FcontentImage%2Fthumb%2F100_100%2F1456496622_a5172febb2.jpg
http://errors.angularjs.org/1.4.3/$interpolate/interr?p0=%7B%7Bnotice.image…ntent%252FcontentImage%252Fthumb%252F100_100%252F1456496622_a5172febb2.jpg
    at ionic.bundle.js:13380
    at Function.$interpolateMinErr.interr (ionic.bundle.js:23899)
    at parseStringifyInterceptor (ionic.bundle.js:24199)
    at Array.regularInterceptedExpression (ionic.bundle.js:27540)
    at interpolationFn (ionic.bundle.js:24169)
    at attrInterpolatePreLinkFn (ionic.bundle.js:21845)
    at invokeLinkFn (ionic.bundle.js:21962)
    at nodeLinkFn (ionic.bundle.js:21441)
    at compositeLinkFn (ionic.bundle.js:20853)
    at nodeLinkFn (ionic.bundle.js:21457)(anonymous function) @ ionic.bundle.js:25642(anonymous function) @ ionic.bundle.js:22421parseStringifyInterceptor @ ionic.bundle.js:24199regularInterceptedExpression @ ionic.bundle.js:27540interpolationFn @ ionic.bundle.js:24169attrInterpolatePreLinkFn @ ionic.bundle.js:21845invokeLinkFn @ ionic.bundle.js:21962nodeLinkFn @ ionic.bundle.js:21441compositeLinkFn @ ionic.bundle.js:20853nodeLinkFn @ ionic.bundle.js:21457compositeLinkFn @ ionic.bundle.js:20853nodeLinkFn @ ionic.bundle.js:21457compositeLinkFn @ ionic.bundle.js:20853publicLinkFn @ ionic.bundle.js:20728boundTranscludeFn @ ionic.bundle.js:20872controllersBoundTransclude @ ionic.bundle.js:21489ngRepeatAction @ ionic.bundle.js:40504$watchCollectionAction @ ionic.bundle.js:28860Scope.$digest @ ionic.bundle.js:28995Scope.$apply @ ionic.bundle.js:29263(anonymous function) @ ionic.bundle.js:31030completeOutstandingRequest @ ionic.bundle.js:18706(anonymous function) @ ionic.bundle.js:18978

set scope variable as data-src

I'd like to set parent scope variable as url like this:

  .controller('TestController', ['$scope', function($scope) {
    $scope.url = '//angularjs.org/img/AngularJS-large.png';
  }]);
    <div ng-controller="TestController">
      <ui-image data-src="{{url}}" data-title="title"></ui-image>
    </div>

I think it doesn't work because {{url}} is set as url without evaluation.
Do you have a plan to support this use case? like this:

bonar@35d8e91

I'm sorry if I misunderstood. I would be happy if you could tell me if there is a better way.
Thank you for great directive.

Bower repo

Hey there,
it would be very handy if you'd add this to the bower repository.

Thanks in advance

Unclear Documentation

Documentation not clear as to how data should be saved and how image should be retrieved.
Should include examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.