JavaScriptAngularJSAngular Notification Message Component

Angular Notification Message Component

Today, I am going to share a very simple angular component to display alert messages on top of the page. With these notification messages, you can display any action like success, error, warning etc. These notification messages design in multi-color so that you could choose notification as per your choice.

Angular Notification Message Component

Installation

1. Download from npm

npm install ngx-notification-msg --save

2. Import the NgxNotificationMsgModule module

import {NgxNotificationMsgModule} from 'ngx-notification-msg'

3. Add NgxNotificationMsgModule to your module imports

 @NgModule({ ... imports: [ ... NgxNotificationMsgModule ] })

4. Import the NgxNotificationMsgService service in any angular component

import {NgxNotificationMsgService} from 'ngx-notification-msg'

5. Inject the NgxNotificationMsgService service in the angular component’s constructor

 constructor(private readonly ngxNotificationMsgService: NgxNotificationMsgService) {

 }

6. Now you can use ngxNotificationMsgService service

 this.ngxNotificationMsgService.open({
    status: NgxNotificationStatusMsg.SUCCESS,
    header: 'Hey',
    msg: 'How are you today ?!'
 });

API

Use the NgxNotificationMsgService service in any angular component you like.

Methods

open(inputsConfig: INgxNotificationMsgConfig, element?: Element): void

Enums & Interfaces

export enum NgxNotificationStatusMsg {
    SUCCESS = 'SUCCESS',
    FAILURE = 'FAILURE',
    INFO = 'INFO',
    NONE = 'NONE'
}

interface INgxNotificationMsgConfig {
    status?: NgxNotificationStatusMsg;
    header?: string;
    msg: string;
    delay?: number;
    closeable?: boolean;
}

See live demo and download the source code.

This awesome script developed by maormoshe. Visit their official repository for more information and follow for future updates.

Subscribe to our Newsletter

Get the Latest Article notification and Weekly Newsletters in your Inbox.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About SAROJ MEHER

He is a Lecturer (English & Sociology), a professional Artist, and a blogger. He do paintings, sketches since his childhood. He is in the teaching field for 10 years. In this teaching line, he has experience in teaching English at High School and College levels. He has also experienced teaching computer theory and practicals during the school teaching period. He is in the Blogging field for more than 5 years.

Subscribe to our Newsletter

Get the Latest Article notification and Weekly Newsletters in your Inbox.

TRENDING ARTICLES

ARTICLESLATEST