/ng-http-loader

Angular 4+ http interceptor - catches all http requests and show a spinkit spinner / loader

Primary LanguageTypeScriptMIT LicenseMIT

Build Status

ng-http-loader

Installation

To install this library, run:

$ npm install ng-http-loader --save

What does it do ?

This package provides an HTTP Interceptor, and a spinner component (All from SpinKit at the moment). The HTTP interceptor listens to all HTTP requests and shows a spinner during pending requests.

Usage

From your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
[...]
import { AppComponent } from './app.component';
import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,    
    NgHttpLoaderModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

In your app.component.html, add :

<spinner></spinner>

You can too customize the background-color and the spinner type :

<spinner [backgroundColor]="'#ff0000'" [spinner]="Spinkit.skWave"></spinner>

The different spinners available are referenced in this class.

Requirements

Compatible with Angular 4.3+.

Credits

The spinners/loaders have been taken from SpinKit.