0.0.8 • Published 5 years ago
ngx-push-notification v0.0.8
NgxPushNotification
This library was generated with Angular CLI version 8.2.11.
Installation
To install this library, run:
npm install ngx-push-notification --save
Setup
Import the NgxPushNotificationService
in your component where you want to use it:
import { NgxPushNotificationService } from 'ngx-push-notification';
...
constructor(private ngxPushNotificationService: NgxPushNotificationService) { }
...
Pushing a Notification
Example:
app.component.html
<button type="button" (click)="notify()">Notify</button>
app.component.ts
notify() {
this.ngxPushNotificationService.showNotification({
title: 'Hello ông thiện',
body: 'Fuck you ông vũ',
icon: '../favicon.ico'
}).subscribe((res: any) => {
if (res.type === 'show') {
console.log('show');
} else if (res.type === 'click') {
console.log('click');
} else {
console.log('close');
}
});
}