import { ModuleWithProviders, NgModule } from '@angular/core';
import { IcsToastComponent } from './ics-toast.component';
import { IcsToastService } from './ics-toast.service';
import { CommonModule } from '@angular/common';
/**
* @howToUse:
*
* Import IcsToastModule in app.module.ts
*
* imports:[
* ...
* IcsToastModule.forRoot()
* ...
* ]
* Add to app.component.html at any where.
*
* At required component get the instance of IcsToastService
*
* constructor(
* ...
* private toastService: IcsToastService,
* ..) {}
*
* onSuccess() {
* this.toastService.success('some text');
* }
* onError() {
* this.toastService.error('some text');
* }
* onLoading() {
* this.toastService.loading('some text');
* }
*
* @description
* Creates a toast at top right of the screen subscribed from IcsToastService.toast$.
*
*
*
* @author Harsha
* */
@NgModule({
imports: [CommonModule],
declarations: [IcsToastComponent],
exports: [IcsToastComponent]
})
export class IcsToastModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: IcsToastModule,
providers: [IcsToastService]
};
}
}