Documentation
Other Components
Common

## Notifications

This component can be used to show latest notifications in a custom made panel. These notifications can be either system wide or applications that sent to the currently logged in user from other users.

It has some basic features including

- marking all notification as read
- marking individual notifications as read
- removing individual notifications from the list

## Usage

The component only has one input to supply the notifications:

<notifications [notifications]="data.notifications"></notifications>

## Notification

export interface Notification { id: string; icon?: string; image?: string; title?: string; description?: string; time: string; link?: string; useRouter?: boolean; read: boolean; }

Name | Description
--- | ---
id | Unique id of the notification.
icon | Icon name for the notification.
image | Image for the notification.
title | Title of the notification.
description | Description of the notification.
time | String representation of the time of the notification (like ISO string).
link | Link of the notification.
useRouter | Whether to use the Router to parse the link.
read | Whether the notification marked as read.

## Notifications Service

The `NotificationsService` can be used to control the notifications outside of the Notifications component. This is particularly useful to control the notifications from other components for actions like creating, updating or deleting them.

### Methods

Here's the list of all available methods from `NotificationsService`:

notifications$: Observable<Notification[]>
Getter for notifications.
store(notifications: Notification[])
Store notifications on the service. This will replace the current notifications and can be used as an alternative to notifications input of the component.
create(notification: Notification): Observable<Notifications>
Create a new notification on the server.
update(id: string, notification: Notification): Observable<Notification>
Update the notification on the server.
delete(id: string): Observable<boolean>
Delete the notification on the server.
markAllAsRead(): Observable<boolean>
Mark all notifications as read.