1.1.1 • Published 2 years ago

ngx-confirmation v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NgxConfirmation

This library is used to open a custom confirmation dialog.

⚙️ Installation

npm install ngx-confirmation --save

📖 Usage

import { NgxConfirmationService } from 'ngx-autohide';

export class SettingsComponent {

  constructor(
    private authService: AuthService,
    private confirmationService: NgxConfirmationService
  ) { }

  onLogOut() {
    // Open confirmation dialog
    const confirmation = this.confirmationService.open({
      title: 'Log out',
      icon: {
        name: 'information',
        color: "primary"
      },
      message: 'Are you sure that you want to log out?',
      actions: {
        confirm: {
          label: 'Yes',
          color: 'primary'
        },
        cancel: {
          label: 'No'
        }
      },
      disableClose: false
    });

    // logout after confirmed
    confirmation.afterClosed().subscribe((result) => {
      if (result === 'confirmed') {
        // call service logout method
        this.authService.logout();
        location.reload();
      }
    })
  }
}

☀️ License

MIT

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago