0.0.4 • Published 6 years ago

ng-full-loader v0.0.4

Weekly downloads
18
License
MIT
Repository
github
Last release
6 years ago

AngularFullLoader

This project was generated with Angular CLI version 6.0.1. AngularFullLoader is simply, complex, complete application loader fired by interceptor, router events or manualy. Whole behaviour can be configured in module or application.

Installation

Run npm install ng-full-loader --save

Demo

Check Loader Demo

Usage

1. Import the NgFullLoaderModule:

Finally, you can use ng-full-loader in your Angular project. You have to import NgFullLoaderModule.forRoot() in the root NgModule of your application.

The forRoot static method is a convention that provides and configures services at the same time. Make sure you only call this method in the root module of your application, most of the time called AppModule. This method allows you to configure the `NgFullLoaderModule';

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {TranslateModule} from '@ngx-translate/core';

@NgModule({
    imports: [
        BrowserModule,
        NgFullLoaderModule.forRoot()
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

After that you need to use Loader Component in your application e.g. in AppComponent

<ng-full-loader></ng-full-loader>
<h1>Hello world</h1>

Now Angular Loader will appear in default configuration: in each HttpRequest, disabled on routing, with 500 ms delay.

2. Configuration:

Default configuration can be changed in NgFullLoaderModule.forRoot() using interface:

export interface ILoaderConfig {
  enableForRouting?: boolean;
  enableForHttp?: boolean;
  defaultDelay?: number;
}

e.g.

NgFullLoaderModule.forRoot({
      enableForRouting: true,
      defaultDelay: 100,
      enableForHttp: false
      })