It is basically a widget to show various colorful notications dynamically. For Example: No internet connection
This library was generated with Angular CLI version 8.2.14.
You can get sp-notifications via npm by either adding it as a new dependency to your package.json file and running npm install, or running the following command:
npm install sp-notifications
First of all, make sp-notifications globally available to your Angular application by importing the NotificationModule the your root Angular module. For example:
import { NotificationModule } from 'sp-notifications';
@NgModule({
imports: [NotificationModule]
})
export class AppModule {}
Variable | README |
---|---|
[data] | All the content you want to show in the notification |
[index] | Index of the particular notification widget |
<ng-container *ngFor="let id of toShow; let i = index">
<sp-notification [index]="i"
[data]="notificationsObj[id]"
(actionPerformed)="btnClicked(id, $event)"
(onClose)="closed(id, i)">
</sp-notification>
</ng-container>
toShow = ['online', 'offline'];
notificationsObj = {
offline: {
style: {
background: 'red'
},
message: 'No internet',
buttons: [
{
id: 'done',
name: 'Done'
}, {
id: 'reload',
name: 'Reload'
}
]
},
online: {
style: {
background: 'green'
},
message: 'Internet is now connected',
buttons: [
]
}
};
btnClicked(id, $event) {
if($event === 'reload') {
window.location.reload();
}
}
closed(id, n) {
console.log('closed');
this.toShow.splice(n, 1);
}
Events | README |
---|---|
(actionPerformed) | Triggered when click is performed on one of the actions |
(onOpen) | Triggered when the notification widget is initialised |
(onClose) | Triggered when the close button is clicked |
E-Mail: [email protected] LinkedIn: https://www.linkedin.com/in/sakshay-phanda-b5a6977a
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.