@ea-controls/spinner
TypeScript icon, indicating that this package has built-in type declarations

18.0.2 • Public • Published

Spinner

The Spinner component provides a circular progress indicator.

Demo

Check out the demo on StackBlitz: Demo

Installation

npm i @ea-controls/spinner

Configuration

// app.config.ts

import { provideEaSpinner } from '@ea-controls/spinner';

export const appConfig: ApplicationConfig = {
  providers: [
    ...
    provideEaSpinner({ // <-- provide spinner
        color?: string // <-- default color is white
    })
  ],
};

Usage

In your component, inject SpinnerService and use its methods show(message?) or hide() to control the spinner:

// app.component.ts

import { SpinnerService } from '@ea-controls/spinner';
import { timer } from 'rxjs';

constructor(private spinnerService: SpinnerService) {
    this.spinnerService.show("Saving data...");

    timer(1000).subscribe(_ => {
        this.spinnerService.show("Data saved...");
    });

    timer(2000).subscribe(_ => {
        this.spinnerService.show("Loading data...");
    });

    timer(3000).subscribe(_ => {
        this.spinnerService.hide();
    });
}

Customization

You can change spinner animation, follow below instructions, use structural directive *ea-spinner-template

<!-- app.component.html -->

<div *ea-spinner-template>
    <img src="https://cdn.pixabay.com/animation/2022/09/16/21/13/21-13-08-279_512.gif" />
</div>

Result

Spinner

Custom Content

You can customize the spinner content as shown below:

Custom Spinner

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 18.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 18.0.2
    1
  • 18.0.1
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i @ea-controls/spinner

Weekly Downloads

1

Version

18.0.2

License

none

Unpacked Size

40 kB

Total Files

13

Last publish

Collaborators

  • eaar0890