angular-lazy-img
Lightweight lazy load images plugin. Only 1kb after gziping. Pure JavaScript, only Angular as dependency.
Installation
-
bower install --save angular-lazy-img
-
Include
angular-lazy-img
in your HTML. -
Inject the
angular-lazy-img
module in your application.angular;
Usage
Just add lazy-img attribute with source to file that you want to lazy load
If you want show spinner put it in src attribute
You want to lazy load background image? No problem, add directive to anything you like and it will handle the rest.
If you need to run the image check manually (for example when clicking on tabs that filter your image result), you can trigger it that way:
$rootScope;
On success and error lazyImg will trigger events on $rootScope - lazyImg:success and lazyImg:error, passing as first param image
Configuration
Inside your config require 'lazyImgConfigProvider' and set custom options.
angular
Use a scrollable container in a dynamic page
Just add lazyImgContainer
attribute to your scrollable container to be considered when you scroll him.
Author
Copyright 2014, Paweł Wszoła (wszola.p@gmail.com)