1.0.1 • Published 4 years ago

ss-loader v1.0.1

Weekly downloads
12
License
MIT
Repository
-
Last release
4 years ago

ss-loader

ss-loader is an angular library to use any image as a loader.

Version

Angularss-loader
>=8.0.0 <9.0.01.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

InputTypeDefaultRequiredDescription
imageUrlstringdefault loadernoprovide the path of your image to show as a loader
sizeinteger200 (in pixel)noprovide the size of the image in pixels,
bgColorcolor#0007nobackground 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.

License

MIT