Angular PrimeNG BlockUI Events
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 know about Angular PrimeNG BlockUI Events.
The BlockUI component is used to block the component or the whole page. There are no such events that are fired on BlockUI. Let's see an example of Block UI.
Syntax:
<p-blockUI
[blocked]="true">
</p-blockUI>
Creating Angular application & module installation:
Step 1: Create an Angular application using the following command.
ng new appname
Step 2: After creating your project folder i.e. appname, move to it using the following command.
cd appname
Step 3: Install PrimeNG in your given directory.
npm install primeng --save
npm install primeicons --save
Project Structure: It will look like the following
Steps to run the application: Run the below command to see the output
ng serve --save
Example 1: This is the basic example that shows how to use the BlockUI Component in Angular PrimeNG.
HTML
<h1 style="color: green;">GeeksforGeeks</h1>
<h2>Angular PrimeNG BlockUI Events</h2>
<p-blockUI [blocked]="gfg"></p-blockUI>
<button
type="button"
pButton
pRipple
label="Click here to block"
(click)="geeks()">
</button>
JavaScript
import { Component } from "@angular/core";
@Component({
selector: "app-root",
templateUrl: "./app.component.html"
})
export class AppComponent {
gfg: boolean = false;
geeks() {
this.gfg = true;
}
}
JavaScript
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { BrowserAnimationsModule }
from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { ButtonModule } from "primeng/button";
import { BlockUIModule } from "primeng/blockui";
import { PanelModule } from "primeng/panel";
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
BlockUIModule,
ButtonModule,
PanelModule,
FormsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
Output:
Example 2: Below is another example code that illustrates the use o Angular PrimeNG BlockUI Events. In this example, we will know how to block a panel in the message component.
HTML
<h1 style="color: green;">GeeksforGeeks</h1>
<h2>Angular PrimeNG BlockUI Events</h2>
<button
type="button"
pButton
pRipple
label="Click Here to Block"
(click)="gfg=true">
</button>
<button
type="button"
pButton
pRipple
label="Click Here to Unblock"
(click)="gfg=false">
</button>
<p-blockUI [target]="geeks" [blocked]="gfg">
<i class="pi pi-lock" style="font-size: 3rem;"></i>
</p-blockUI>
<p-panel #geeks header="BlockUI" styleClass="p-mt-4">
<p class="p-m-0">
Angular PrimeNG is a framework used
with angular to create components with
great styling and this framework is very
easy to use and is used to make responsive
websites.
</p>
</p-panel>
JavaScript
import { Component } from "@angular/core";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
})
export class AppComponent {
gfg: boolean = false;
geeks() {
this.gfg = true;
setTimeout(() => {
this.gfg = false;
}, 3000);
}
}
JavaScript
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { BrowserAnimationsModule }
from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { ButtonModule } from "primeng/button";
import { BlockUIModule } from "primeng/blockui";
import { PanelModule } from "primeng/panel";
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
BlockUIModule,
ButtonModule,
PanelModule,
FormsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
Output:
Reference: https://primefaces.org/primeng/blockui
Similar Reads
Angular PrimeNG BlockUI Methods 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 BlockUI Methods in Angular PrimeNG. The BlockUI Compone
3 min read
Angular PrimeNG Chip Events Angular PrimeNG is a UI component library for Angular Applications. It offers many pre-built themes and UI components for various tasks like inputs, menus, charts, Buttons, etc. In this article, we will see Angular PrimeNG Chip Events. The Chip component represents entities using text, icons, and im
3 min read
Angular PrimeNG BlockUI Document Angular PrimeNG is a front-end UI toolkit for Angular applications. It has a wide variety of angular components that helps developers to build web applications in less time as they don't have to make everything from scratch. In this article, we will discuss BlockUI Document in Angular PrimeNG. The B
3 min read
Angular PrimeNG BlockUI 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 know how to use the BlockUI component in Angular PrimeNG. BlockUI component
3 min read
Angular PrimeNG BlockUI Panel Angular PrimeNG is a front-end UI toolkit for Angular applications. It has a wide variety of angular components that helps developers to build web applications in less time as they don't have to make everything from scratch. In this article, we will discuss the Angular PrimeNG BlockUI Panel. The Blo
3 min read
Angular PrimeNG Dialog Events 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 Dialog Events in Angular PrimeNG. The Dialog Component
3 min read