UNPKG

ss-loader

Version:

README.md

73 lines (54 loc) 1.85 kB
# 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](https://nodejs.org/en/download/) to install ss-loader. ```bash npm install ss-loader ``` ## Usage Add the following to your app.module.ts file ```typescript import { SsLoaderModule } from 'ss-loader'; imports: [ . . . SsLoaderModule <--- import here ], ``` Next import ss-loader service to your component.ts file ```typescript 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 ```html <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. ## License [MIT](https://choosealicense.com/licenses/mit/)