Angular PrimeNG Inplace 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 Inplace component in Angular PrimeNG. We will also learn about the properties, events, methods & styling along with their syntaxes that will be used in the code.
Inplace component: It is used to edit & display the content inplace of others at the same time & render the actual output while clicking the button to display.
- active: It is used to specify whether the content is displayed or not. It is of boolean datatype & the default value is false.
- disabled: It specifies that the element should be disabled. It is of the boolean data type, the default value is false.
- closable: It Displays a button to switch back to display mode. It is of the boolean data type, the default value is false.
- preventClick: It specifies whether the component can be controlled full programmatic with activate() and deactivate() functions. It is of the boolean data type, the default value is false.
- style: It sets an inline style of the component. It is of string data type, the default value is null.
- styleClass: It is the style class of the component. It is of string data type, the default value is null.
- closeIcon: It is the close icon, It is of string data type, the default value is pi pi-times.
- onActivate: It is a callback that is fired when content is activated.
- onDeactivate: It is a callback that is fired when content is deactivated
- activate: It is used to activates the content.
- deactivate: It is used to deactivates the content.
- p-inplace: It is the Container element
- p-inplace-display: It is the Display container
- p-inplace-content: It is the Content container
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.
Step 3: Install PrimeNG in your given directory.
npm install primeng --save npm install primeicons --save
Project Structure: It will look like the following:
Example 1: This is the basic example that illustrates how to implement the closable property in the Inplace Component.
Example 2: In this example, we are making a button inside the Inplace Component.