A simple angular library for adding loaders
Add easily an overlay loader over any kind of component. Fully customizable with your own components.
Checkout the demo at: https://silvere112.github.io/ngx-load/
ngx-load | Angular |
---|---|
0.1.0 | 14 |
0.0.7 | 13 |
- 🔥 Works with Angular & HTML elements
- ⏳ Easy to install
- 🛠 Customizable
- ☕ Easy to use
If not already done you should setup Angular CDK as mention here.
Install the dependency with
npm i @angular/cdk
Then add the following snippet in your global style.scss
@import '@angular/cdk/overlay-prebuilt.css';
Install it through npm with :
npm i ngx-load
import { NgxLoadModule } from "ngx-load";
@NgModule({
imports: [NgxLoadModule]
})
class AppModule {}
import { NgxLoadModule } from "ngx-load";
@NgModule({
imports: [
NgxLoadModule.with({
loaderComponent: YourLoaderComponent
})
]
})
class AppModule {}
Checkout the demo at: https://stackblitz.com/github/Silvere112/ngx-load-examples/tree/main/LoaderService/mat-table
@Component({
selector: 'example',
template: `
<div class="element"> {{ content | async }} </div>
`,
styles: [
`
.element {
width: 100px;
height: 100px;
}
`
]
})
export class ExampleComponent {
content = timer(1000)
.pipe(map(() => "Hello World"))
.pipe(this.loaderService.attachLoader())
constructor(public loaderService: LoaderService) {
}
}
Checkout the demo at: https://stackblitz.com/github/Silvere112/ngx-load-examples/tree/main/OverlayLoaderDirective/mat-table
@Component({
selector: 'example',
template: `
<div [loadOverlayLoader]="content" class="element"> {{ content | async }} </div>
`,
styles: [
`
.element {
width: 100px;
height: 100px;
}
`
]
})
export class ExampleComponent {
content = timer(1000).pipe(map(() => "Hello World"))
}
TODO: make example
- Readme inspired from @ngneat/hot-toast
- @etiennecrb for the ElementRuler taken from this thread
- loading.io for the default loader