Angular 2+ / Ionic 2+ module to cache images for offline use.
Important Note: this module supports Angular / Ionic versions 2 and above only. For Angular 1.x / Ionic 1.x, consider angular-imgcache.js, which this module was inspired by.
npm install ng-imgcache
1. Install Cordova plugins:
cordova plugin add cordova-plugin-file cordova-plugin-file-transfer
2. Import the
3. Initialise the cache in your
4. Use the directive in your component templates:
TBC: a very similar process to above.
How it works
Image URLs that are specified in a
img-cache-bg-url attribute will be downloaded and cached for subsequent offline use by the included
Tip: make sure you use
<img> tags, as this will set the
src attribute of the
<img> tag to the cached image. For other elements, you can use the
img-cache-bg-url attribute, which will set the
background-image style of the element to point to the cached image.