@von-development-studio/primeng-message-service
v1.0.0
Published
Angular + PrimeNG Message Service.
Downloads
3
Maintainers
Readme
PrimeNG Message Service
This library was generated with Angular CLI version 11.0.3.
Installing
- Add NPM package into your project:
npm i @von-development-studio/primeng-message-service -S
- Add VonMessageService into
providers
section
import { MessageService } from 'primeng/api';
import { VonMessageService } from '@von-development-studio/primeng-message-service';
...
@NgModule({
providers: [
...
MessageService,
VonMessageService,
...
]
})
export class AppModule { }
Usage
Add service VonMessageService in your constructor and use it:
import { Component } from "@angular/core";
import { VonMessageService } from "@von-development-studio/primeng-message-service";
@Component({
selector: "lib-root",
templateUrl: "./app.component.html",
})
export class AppComponent {
constructor(protected messageService: VonMessageService) {}
addSuccess = () => this.messageService.addSuccess("Success Message");
addInfo = () => this.messageService.addInfo("Info Message");
addWarning = () => this.messageService.addWarning("Warning Message");
addError = () => this.messageService.addError("Error Message");
}