Angular PrimeNG Tag Templating
Last Updated :
26 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. Tag component: It is used to make a tag in order to categorize the content.
This article will show us the Tag Templating in Angular PrimeNG. Altering the normal behavior by using the tag template where we can define custom content.
Approach: Let us create an Angular project and install the PrimeNG UI module. Then we will create a UI that will showcase Angular PrimeNG Tag Templating.
Syntax:
<p-tag>
...
</p-tag>
Creating Angular Application & module installation:
Step 1: To create an angular app, you need to install angular by 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 react 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 running the commands mentioned in the above steps, if you open the project in an editor you can see a similar project structure as shown below. The new component user makes or the code changes, we will be performing will be done in the source folder.
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: We are creating a UI that shows Angular PrimeNG Tag Templating. Here, we are inserting an avatar inside the tag.
HTML
<div style="margin:100px; text-align: center;">
<h1 style="color: green">
GeeksforGeeks
</h1>
<h3>
Angular PrimeNG Tag Templating
</h3>
<p-tag [style]="{width:'100px',height:'100px'}">
<p-avatar
size="xlarge"
shape="circle"
icon="pi pi-user">
</p-avatar>
</p-tag>
</div>
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AvatarModule } from 'primeng/avatar';
import { AppComponent } from './app.component';
import { TagModule } from 'primeng/tag';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AvatarModule,
TagModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Example 2: We are creating a UI that shows Angular PrimeNG Tag Templating. Here, we are inserting a progress spinner component inside the tag.
HTML
<div style="margin:100px; text-align: center;">
<h1 style="color: green">
GeeksforGeeks
</h1>
<h3>
Angular PrimeNG Tag Templating
</h3>
<p-tag [style]="{width:'100px',height:'100px'}"
severity="success">
<p-progressSpinner
strokeWidth="2"
fill="#FAEBD7">
</p-progressSpinner>
</p-tag>
</div>
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from
'@angular/platform-browser';
import { AppComponent } from './app.component';
import { ProgressSpinnerModule }
from 'primeng/progressspinner';
import { TagModule } from 'primeng/tag';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ProgressSpinnerModule,
TagModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Reference: http://primefaces.org/primeng/tag
Similar Reads
Angular PrimeNG Table Templating
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 about Angular PrimeNG Table Templating. The Table is used to display
4 min read
Angular PrimeNG Tree Templating
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 Angular PrimeNG Tree Templating. The Tree in Angular PrimeNG is uti
4 min read
Angular PrimeNG Chip Templating
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. Chip component is used to represent icons, labels, and images. This article will show us the Chip T
3 min read
Angular PrimeNG Table Templates
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.
6 min read
Angular PrimeNG Avatar Templating
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. Avatars are used to denote letters, icons, and images in different shapes and background colors. Thi
3 min read
Angular PrimeNG TabView Templates
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 TabView Templates in Angular PrimeNG. Angular PrimeNG fa
3 min read
Angular PrimeNG TreeTable Templating
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.
6 min read
Angular PrimeNG Splitter Templates
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 know how to use the Splitter Templates in Angular PrimeNG. The Splitter Com
2 min read
Angular PrimeNG FileUpload Templating
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 know how to use FileUpload Templating in Angular PrimeNG. The FileUpload Co
3 min read
Angular PrimeNG Timeline Templates
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 Timeline Component in Angular PrimeNG. Angular PrimeNG Tim
3 min read