Severities in Angular Message component

27 Sep 20232 minutes to read

The severity denotes the importance and context of the message to the user. The message contains different severity types. Use the severity property to display the messages with different severity levels.

The available severity types are Normal, Success, Info, Warning and Error. The default severity type for messages is Normal.

The following example demonstrates the severity of the messages.

import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    template: `<div class="msg-default-section">
        <div class="content-section">
            <ejs-message id="msg_default" content="Editing is restricted"></ejs-message>
            <ejs-message id="msg_info" content="Please read the comments carefully" severity="Info"></ejs-message>
            <ejs-message id="msg_success" content="Your message has been sent successfully" severity="Success"></ejs-message>
            <ejs-message id="msg_warning" content="There was a problem with your network connection" severity="Warning"></ejs-message>
            <ejs-message id="msg_error" content="A problem occurred while submitting your data" severity="Error"></ejs-message>
        </div>
    </div>`
})
export class AppComponent{
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MessageModule } from '@syncfusion/ej2-angular-notifications';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule, MessageModule
    ],
    declarations: [AppComponent ],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);