ss-loader
ss-loader is an angular library to use any image as a loader.
Version
Angular | ss-loader |
---|
=8.0.0 <9.0.0|1.0.0
Warning
The library is under active development and may have API breaking changes for subsequent major versions after 1.0.0.
Installation
Use the package manager npm to install ss-loader.
npm install ss-loader
Usage
Add the following to your app.module.ts file
import { SsLoaderModule } from 'ss-loader';
imports: [
. . .
SsLoaderModule <--- import here
],
Next import ss-loader service to your component.ts file
import { SsLoaderService } from 'ss-loader';
. . .
export class AppComponent implements OnInit {
constructor(private loader: SsLoaderService){
}
url ="assets/loader.gif"; <-- path of gif file
bgcolor = '#0009'; <-- background color
size = 400; <-- gif size in pixels
ngOnInit(){
this.loader.display(true); <-- pass 'true' display loader
setTimeout(() => {
this.loader.display(false); <-- pass false to hide loader
}, 10000);
}
Use ss-loader selector in your component.html template
<ss-loader [imageUrl]='url' [size]='size' [bgColor]='bgcolor'>
API
Input | Type | Default | Required | Description |
---|---|---|---|---|
imageUrl |
string | default loader | no | provide the path of your image to show as a loader |
size |
integer | 200 (in pixel) | no | provide the size of the image in pixels, |
bgColor |
color | #0007 | no | background color of the loader |
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.