17.0.2 • Published 3 months ago

ngx-loading-buttons v17.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

npm npm npm bundle size (minified + gzip) ngx-loading-buttons PRs All Contributors npm

A lightweight Angular library to add a loading spinner to your Angular Material buttons.

Installation

ng add ngx-loading-buttons

Usage

Import the NgxLoadingButtonsModule into your AppModule. You can configure it as shown below:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgxLoadingButtonsModule } from 'ngx-loading-buttons';

import { AppComponent } from './app.component';

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

And last of all, add it to your <button> element like this.

<button mat-raised-button [mtBasicSpinner]="true">Basic</button>

You can also hide the button's text like this.

<button mat-raised-button [mtBasicSpinner]="true" [hideText]="true">Basic</button>

A "real-world component" would likely look like this.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  saving: boolean = false;

  save(): void {
    this.saving = true;
    // Juggle 5 hens while wiggling your toes and other magic... 🤡
  }


}

And our template file.

<button mat-raised-button [mtBasicSpinner]="saving" (click)="save()">Basic</button>

Issues 🐛

Found a bug? Want to request a feature? Confused? Or wanna simply comment on how useful this library is?

Open an issue here.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification.

Contributions of any kind welcome!

Credits

  • Fidget-spinner icons created by Smashicons - Flaticon
17.0.2

3 months ago

17.0.1

6 months ago

17.0.0

6 months ago

16.0.1

7 months ago

16.0.0

11 months ago

15.0.1

1 year ago

15.0.0

1 year ago

14.0.4

1 year ago

14.0.1

2 years ago

14.0.2

2 years ago

14.0.3

2 years ago

14.0.0

2 years ago

13.0.3

2 years ago

13.0.2

2 years ago

13.0.1

2 years ago

12.0.0

2 years ago

11.0.0

2 years ago

13.0.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago