How to get image loader in ionic!. Currently in ionic we use modules to load online images, because we want the application to run in the background when loading images we have to use the ionic image loader.
Usage
This HTML
Ionic image loader là gì?
image loader is module that loads image in a background thread and caches them for later use.Installation image loader
1. Install the NPM Packagenpm install --save ionic-image-loader2. Install Required Plugins
npm i --save @ionic-native/file
ionic cordova plugin add cordova-plugin-file3. Import IonicImageLoader module
add IonicImageLoader.forRoot() in your app's root moduleThen add IonicImageLoader in your child/shared module(s)
import { IonicImageLoader } from 'ionic-image-loader';
// import the module
@NgModule({
...
imports: [
IonicImageLoader.forRoot()
]
})
export class AppModule {}
import { IonicImageLoader } from 'ionic-image-loader';
@NgModule({
...
imports: [
IonicImageLoader
]
})
export class SharedModule {}
Usage
This HTML
<img-loader src="https://path.to/my/image.jpg"></img-loader>View our example project here: https://github.com/zyramedia/ionic-image-loader-example
No comments:
Post a Comment