@hangar42/ngx-toast-it
v1.3.1
Published
ngxToastIt is a simple and lightweight Angular module providing Toasts for your application. Purely written in Angular 8 and designed by hand.
Downloads
4
Readme
ngxToastIt
ngxToastIt is a simple and lightweight Angular module providing Toasts for your application. Purely written in Angular 8 and designed by hand.
Just have a look at the Demo
Installation
Install via NPM:
npm install @hangar42/ngx-toast-it
or manually download it.
Usage
1. Include ngxToastIt as a dependency in your desired module:
import {ToastItModule} from 'ngx-toast-it';
...
imports: [
ToastItModule,
...
]
2. Inject ToastItService in any class of the module:
constructor(private toastItService: ToastItService){}
3. (Optional) Setup Config
import {ToastConfig, ToastPosition} from 'ngx-toast-it';
...
public toastConfig: ToastConfig = {
position?: ToastPosition.topRight,
groupingThreshold?: 5,
progressBarEnabled?: true
};
public someFunction(){
this.toastItService.setConfig(this.toastConfig);
}
4. Create and fire Toast
import {Toast, ToastType} from 'ngx-toast-it';
...
public toast: Toast = {
type: ToastType.success,
heading: 'Great',
subheading?: 'You found the Toast Component',
message: 'Let us know what you like about it',
timeout?: 0
};
...
public someFunction(){
this.toastItService.createToast(this.toast);
}
Development
- Clone the repo or download it
- Install dependencies:
npm install
- Run
npm run build:library
- Run
ng serve
License
GPLv3 Link