Code Monkey home page Code Monkey logo

angular-preload-image's People

Contributors

alexrayan avatar ivan-perez avatar moatazabdallh avatar revillweb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

angular-preload-image's Issues

It kills other directives

This does not work
<img class="my-image" preload-image default-image="default.jpg" fallback-image="error.jpg" ng-src="my-image.jpg"/>

This works
<img class="my-image" ng-src="my-image.jpg"/>

my-image.directive.js

function myImage () {
	return {
		restrict: 'C',
		link: function (scope, $element, attrs) {
			$element.on('load error', function () { // this line is not triggered
				doSomethingWhenTheImageIsLoaded();
			});
		}
	};
}

myImage.$inject = [];
angular.module('chat').directive('myImage', myImage);

How do I know image finished loading

How do I know image finished loading? You said directive have ability to know when all pre-loaded images have finished loading within the page

ng-click is not working with this

i noticed that ng-click works no more when i use this plugin with it on img tag

eg:

<img preload-image ng-src="{{item.imgUrl}}" default-image="../img/thumb2.png" fallback-image="{{item.imgUrl}}" ng-click="addToOrder(item)" />

The function addToOrder doesnt get executed on click

Loading Image that has already been used

When I'm trying to use the tag for an image, that has already been preloaded once in a different view, the image is not being displayed. Only when I remove the preload-image directive from the tag and only use ng-src the image is being displayed immediately. Generally speaking this behavior is fine, but I always have to remember which image is already pre-loaded.

not pictured

I am using this great module but can not get it to work.
only shows me the image set in fall , I'm getting data from a REST API , and I think the view is loaded before the data is downloaded and later

<div class="hero slide-up"  preload-bg-image="
{{local.featured_image.attachment_meta.sizes.large.url}}" 
default-image="../img/material-graphite.jpg" 
fallback-image="../img/material3.jpg"></div>

controller

    $http({
        method: 'GET',
        url: 
    }).
    success(function (data, status, headers, config) {
         $scope.local = data;}

Event listeners not properly cleaned up

When you create the new image in the preLoader service you attach the 'load' and 'error' event handlers. As far as I know (and tested), these listeners need to be cleaned up otherwise you'll be left with a leak.
Something like this worked for me:

var preloaderImage = angular.element(new Image());
preloaderImage.on('load', function () {
      preloaderImage.off();
      successCallback();
}).on('error', function () {
      preloaderImage.off();
      errorCallback();
}).attr('src', url);

"terminal" property of preloadImage breaks other directives

Hi there,
I really like the directive thanks very much for your work.
I just thought I should report that the terminal property of the preloadImage directive can break other directives really badly. Both "ui-sref" from the ui.router module and "on-touch" from Ionic are broken when "preload-image" is applied to the same element. I'm sure there's a reason you've included this property, however I've removed it in this fork and have had no adverse effects so far.

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.