Home

Awesome

Angular2 Loading Animate

Build Status npm version devDependency Status GitHub issues GitHub stars GitHub license

Demo

https://oxycoder.github.io/ng2-loading-animate/demo/

Table of contents

About

Loading animation for angular 2

Installation

Install through npm:

npm install --save ng2-loading-animate

Then use it in your app like so:

app.module.ts

import { LoadingAnimateModule, LoadingAnimateService } from 'ng2-loading-animate';

@NgModule({
  imports: [
    ...
    LoadingAnimateModule.forRoot()
    ...
  ],
  providers: [
    ...
    LoadingAnimateService
    ...
  ]
})

Add directives to your app.component.html (usually at top):

<loading-animate></loading-animate>

In component, to start loading animate: test.component.ts

import { LoadingAnimateService } from 'ng2-loading-animate';

constructor(private _loadingSvc: LoadingAnimateService)

start() {
  this._loadingSvc.setValue(true);
}
stop() {
  this._loadingSvc.setValue(false);
}

Development

Prepare your environment

Development server

Run npm start to start a development server on port 8000 with auto reload + tests.

Testing

Run npm test to run tests once or npm run test:watch to continually run tests.

License

MIT