Angular PrimeNG Inplace Methods
Last Updated :
26 Apr, 2025
Angular PrimeNG is a UI component library for Angular Applications. It offers many pre-built themes and UI components for a variety of tasks like inputs, menus, charts, Buttons, etc. In this article, we will see Angular PrimeNG Inplace Methods.
The Inplace component is used to provide an easy to do editing and display to the user. When the output of the Inplace component is clicked the content is revealed. There are two methods for the Inplace components which are listed below.
Angular PrimeNG Inplace Methods:
- activate: This method activates the Inplace content.
- deactivate: This method deactivates the Inplace content.
Angular PrimeNG Inplace Templates:
- display: This template is used to specify the display part of the Inplace.
- content: This template is used to specify the content part of the Inplace.
Syntax:
// File: app.component.html
<p-inplace #inplace>
<ng-template pTemplate="display">
...
</ng-template>
<ng-template pTemplate="content">
...
</ng-template>
</p-inplace>
// File: app.component.ts
this.inplace.activate();
this.inplace.deactivate();
Creating Angular Application and Installing the Module:
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: Finally, Install PrimeNG in your given directory.
npm install primeng --save
npm install primeicons --save
Project Structure: The project Structure will look like this after following the above steps:

Project Structure
Example 1: In this example, we used the activate method of the inplace component to activate its content. We form the method by attaching it to the button click.
HTML
< h2 style = "color: green;" >GeeksforGeeks</ h2 >
< h3 >Angular PrimeNG Image Templates</ h3 >
< button
pButton
label = "Activate Inplace"
(click)="inplaceActivate()"
class = "mb-6" >
</ button >
< p-inplace #inplace>
< ng-template pTemplate = "display" >
Click to see image
</ ng-template >
< ng-template pTemplate = "content" >
< img src =
width = "200" >
</ ng-template >
</ p-inplace >
|
Javascript
import { Component, ViewChild } from "@angular/core" ;
import { Inplace } from "primeng/inplace" ;
@Component({
selector: "app-root" ,
templateUrl: "./app.component.html" ,
styles: []
})
export class AppComponent {
@ViewChild( 'inplace' ) ip!: Inplace;
inplaceActivate() {
this .ip.activate();
}
}
|
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 { TableModule } from "primeng/table" ;
import { InplaceModule } from "primeng/inplace" ;
import { ButtonModule } from "primeng/button" ;
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
InplaceModule,
FormsModule,
TableModule,
ButtonModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule { }
|
Output:
Example 2: In this example, we used both the deactivate and activate methods of the Inplace component to activate and deactivate the inplace content.
HTML
< h2 style = "color: green;" >GeeksforGeeks</ h2 >
< h3 >Angular PrimeNG Image Templates</ h3 >
< button
pButton
label = "Activate Inplace"
(click)="inplaceActivate()"
class = "mb-4 mr-3" >
</ button >
< button
pButton
label = "Deactivate Inplace"
(click)="inplaceDeactivate()"
class = "mb-4" >
</ button >
< p-inplace #inplace>
< ng-template pTemplate = "display" >
Click to see image
</ ng-template >
< ng-template pTemplate = "content" >
< img src =
width = "200" >
</ ng-template >
</ p-inplace >
|
Javascript
import { Component, ViewChild } from "@angular/core" ;
import { Inplace } from "primeng/inplace" ;
@Component({
selector: "app-root" ,
templateUrl: "./app.component.html" ,
styles: []
})
export class AppComponent {
@ViewChild( 'inplace' ) ip!: Inplace;
inplaceActivate() {
this .ip.activate();
}
inplaceDeactivate() {
this .ip.deactivate();
}
}
|
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 { TableModule } from "primeng/table" ;
import { InplaceModule } from "primeng/inplace" ;
import { ButtonModule } from "primeng/button" ;
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
InplaceModule,
FormsModule,
TableModule,
ButtonModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule { }
|
Output:
Reference: http://primefaces.org/primeng/inplace
Similar Reads
Angular PrimeNG Menu Methods
Angular PrimeNG is an open-source library that consists 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 discuss Angular PrimeNG Menu Methods. The Menu component is used for navigating
4 min read
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 Inplace Data
Angular PrimeNG is a UI component library for Angular Applications. It offers many pre-built themes and UI components for a variety of tasks like inputs, menus, charts, Buttons, etc. In this article, we will be seeing Angular PrimeNG Inplace Data. The Inplace component is used to provide an easy to
3 min read
Angular PrimeNG Tree 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. It provides a lot of templates, components, theme designs, an extensive icon library, and much more.
5 min read
Angular PrimeNG Inplace Basic
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 Inplace Basic in Angular PrimeNG. We will also learn about
3 min read
Angular PrimeNG Inplace Image
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 Inplace Image in Angular PrimeNG. We will also learn about
3 min read
Angular PrimeNG Slide Menu 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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
4 min read
Angular PrimeNG Table 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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
6 min read
Angular PrimeNG Inplace Events
Angular PrimeNG is a UI component library built by PrimeTek for helping out Angular developers for easing the process of developing consistent and scalable web interfaces in less time. In this article, we will see the Inplace Events in Angular PrimeNG. The Inplace Component is used in place of other
3 min read
Angular PrimeNG Inplace Styling
Angular PrimeNG is a UI component library for Angular Applications. It offers many pre-built themes and UI components for a variety of tasks like inputs, menus, charts, Buttons, etc. In this article, we will see Angular PrimeNG Inplace Styling. The Inplace component is used to provide an easy to do
3 min read