Angular PrimeNG Messages Static Content
Last Updated :
28 Apr, 2025
Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see the static content in Messages Component in Angular PrimeNG.
The Messages component is used to display a message with particular severity. To display the static content, the user can make use of the message template. Message service is ignored and no need to assign any value.
Syntax:
<p-messages severity="info">
<ng-template pTemplate>
...
</ng-template>
</p-messages>
Creating Angular application & Module Installation:
Step 1: To create an angular app, you need to install the angular command line interface through the npm command:
npm install -g angular-cli
Step 2: Now, we will create an angular project:
ng new project_name
Step 3: After creating your angular project, move into the folder to perform different operations:
cd project_name
Step 4: After creating the Angular application, Install the required module using the following command:
npm install primeng --save
npm install primeicons --save
Project Structure: After successful installation, the following project structure will appear:
Project Structure- Step to Run Application: Run the application using the following command from the root directory of the project:
ng serve --open
Example 1: This example describes the Angular PrimeNG Messages Static Content.
HTML
<div style="margin:100px;">
<h1 style="color: green">GeeksforGeeks</h1>
<h3>Angular PrimeNG Messages Static Content</h3>
<p-messages severity="success">
<ng-template pTemplate>
<img src=
'https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg'
width="32" />
<div class="ml-2">Geeks For Geeks</div>
</ng-template>
</p-messages>
</div>
JavaScript
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
})
export class AppComponent { }
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule }
from '@angular/platform-browser';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { MessagesModule } from "primeng/messages";
import { ToastModule } from 'primeng/toast';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
MessagesModule,
ToastModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Output:
Example 2: This example describes the Angular PrimeNG Messages Static Content.
JavaScript
<div style="margin:100px;">
<h1 style="color: green">GeeksforGeeks</h1>
<h3>Angular PrimeNG Messages Static Content</h3>
<p-messages severity="error">
<ng-template pTemplate>
<i class="pi pi-times-circle pi-spin"></i>
<div class="ml-2">Error occurred</div>
</ng-template>
</p-messages>
<p-messages severity="info">
<ng-template pTemplate>
<div class="ml-2">Information received</div>
<i class="pi pi-info-circle pi-spin"></i>
</ng-template>
</p-messages>
<p-messages severity="warn">
<ng-template pTemplate>
<i class="pi pi-exclamation-triangle pi-spin"></i>
<div class="ml-2">Alert message</div>
</ng-template>
</p-messages>
</div>
JavaScript
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
})
export class AppComponent { }
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule }
from '@angular/platform-browser';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { MessagesModule } from "primeng/messages";
import { ToastModule } from 'primeng/toast';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
MessagesModule,
ToastModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Output:
Reference: https://primefaces.org/primeng/messages
Similar Reads
Angular PrimeNG Messages Severities Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. This article will show us how to use the Messages Severities in Angular PrimeNG. We will also learn
3 min read
Angular PrimeNG Messages Dynamic Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see how to use the Messages Dynamic in Angular PrimeNG. We will also learn
3 min read
Angular PrimeNG Message Service Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. This article will show us how to use the Messages Service in Angular PrimeNG. We will also learn abo
3 min read
Angular PrimeNG Messages Static Content Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see the static content in Messages Component in Angular PrimeNG. The Messa
3 min read
Angular PrimeNG Messages Inline Message Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see how to use the Messages Inline Message in Angular PrimeNG. We will also
3 min read
Angular PrimeNG Messages Array Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see the Messages Array in Angular PrimeNG. The Messages component is used t
3 min read
Angular PrimeNG Messages Closable Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see how to use the Messages Closable in Angular PrimeNG. We will also learn
3 min read
Angular PrimeNG Message Component Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will learn how to use the Message Component in Angular PrimeNG. We will also lea
3 min read
Angular PrimeNG Messages Animation Configuration Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
4 min read
Angular PrimeNG Properties of Messages Component Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will learn how to use the Messages Properties in Angular PrimeNG. We will also l
4 min read