0.0.4 • Published 5 years ago
@ognanshissi/ngx-loader v0.0.4
Angular loader NgxLoader
Getting Started
NgxLoader help you handle page loading, posting data to the server loading state and more others example of loading more easier.
- You have svg loaders integrated
- Loader handle with a service state
Installation
If you are a fan of npm
npm install @ognanshissi/ngx-loader OR npm i @ognanshiss/ngx-loader
If you are a fan of yarn
yarn add @ognanshissi/ngx-loader
Usage
- Add
NgxLoaderModule
insideapp.module.ts
imports array
import {NgxLoaderModule, NgxLoaderTypeEnum} from '@ognanshissi/ngx-loader';
@NgModule({
// ..
imports: [
// ...
NgxLoaderModule.forRoot({
type: NgxLoaderTypeEnum.AUDIO
})
// ...
]
// ...
})
export class AppModule {}
- Add
<ngx-loader></ngx-loader>
component insideapp.component.html
with configuration.
<ngx-loader></ngx-loader>
<router-outlet></router-outlet>
- Handle the loader state inside
app.component.ts
import {NgxLoaderService} from '@ognanshissi/ngx-loader'
@Component({
//...
})
export class AppComponent implement OnInit {
constructor (
private ngxLoaderService: NgxLoaderService
){}
ngOnInit(){
// How you can trigger loader
this.ngxLoaderService.setLoader(true);
setTimeOut(() => {
this.ngxLoaderService.setLoader(false);
}, 5000)
}
}