Documentation
Other Components
Common

## Messages

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

It has some basic features including

- marking all messages as read
- marking individual messages as read
- removing individual messages from the list

## Usage

The component only has one input to supply the messages:

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

## Message

export interface Message { 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 message.
icon | Icon name for the message.
image | Image for the message.
title | Title of the message.
description | Description of the message.
time | String representation of the time of the message (like ISO string).
link | Link of the message.
useRouter | Whether to use the Router to parse the link.
read | Whether the message marked as read.

## Messages Service

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

### Methods

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

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