ng-bs-toast-service
v0.0.1
Published
Toast Service for Angular and Bootstrap 5.
Downloads
4
Readme
NgBsToastService
Toast Service for Angular and Bootstrap 5.
Getting started
Step 1: Install ng-bs-toast-service
NPM
npm install --save ng-bs-toast-service
YARN
yarn add ng-bs-toast-service
Step 2: Import the NgBsToastServiceModule
import { NgBsToastServiceModule } from 'ng-bs-toast-service';
@NgModule({
declarations: [...],
imports: [NgBsToastServiceModule],
bootstrap: [...]
})
export class AppModule {}
Step 3: Add ng-bs-toast-service tag
Add in app-component.html
<ng-bs-toast-service></ng-bs-toast-service>
Usage
Data source:
constructor(private toastService: NgBsToastService) {}
showToast() {
this.toastService.send('Titulo 1', 'Message 1', 'primary');
}
In template:
<button type="button" class="btn btn-primary" (click)="showToast()">Show Toast</button>
Interfaces
ToastService.send(title: string, message: string | null, style?: 'success' | 'warning' | 'danger' | 'primary')