johninvictus / angular-img-cache

A directive to cache images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AngularImgCache

Once you add the cache module you can use this directive like this,

<img srcCache="https://static.wixstatic.com/media/9d95ec_331689f9f63b4b538509abb1d306ff20~mv2.gif"
       imageCache onErrorSrc="./assets/not_found.png"
       width="500px" loader="./assets/tenor.gif">

The only required field are imageCache and srcCache.

Don't forget to use srcCache instead of src. You can use add onErrorSrc and loader field to indicate error and loading states.

Setup

This project was generated with Angular CLI version 9.1.0.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

About

A directive to cache images


Languages

Language:HTML 68.1%Language:TypeScript 27.2%Language:JavaScript 4.6%Language:CSS 0.2%