Skip to content
A simple AngularJS module to make it easy to pre-load images.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
bower_components/angular
LICENSE
README.md
angular-preload-image.js
angular-preload-image.min.js
bower.json

README.md

angular-preload-image

A simple AngularJS module to make it easy to pre-load images to prevent the horrible waterfall effect: Demo.

Installation

Install with bower

bower install angular-preload-image

Include script files

<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-preload-image/angular-preload-image.min.js"></script>

Add module dependency

angular.module('app', ['angular-preload-image']);

Usage

Pre-load background images

<div preload-bg-image="[URL]" default-image="[URL]" fallback-image="[URL]"></div>

Pre-load standard images

<img preload-image ng-src="[URL]" default-image="[URL]" fallback-image="[URL]" />

Licence

MIT

Demo

Check out the demo for an example of pre-loading background images and pre-loading standard images with AngularJS.

TO DO

  • Ability to know when all pre-loaded images have finished loading within the page
  • Extensive cross browser and device testing + fixes

Credit

Inspiration taken from Ben Nadel's post about pre-loading images.

You can’t perform that action at this time.