ss-loader
Version:
README.md
73 lines (54 loc) • 1.85 kB
Markdown
ss-loader is an angular library to use any image as a loader.
Angular | ss-loader
--- | ---
>=8.0.0 <9.0.0|1.0.0
The library is under active development and may have API breaking changes for subsequent major versions after 1.0.0.
Use the package manager [npm](https://nodejs.org/en/download/) to install ss-loader.
```bash
npm install ss-loader
```
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'>
```
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 |
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.
[](https://choosealicense.com/licenses/mit/)