InplaceInplace provides an easy to do editing and display at the same time where clicking the output displays the actual content.

Inplace - 图1

Documentation

Import

  1. import {InplaceModule} from 'primeng/inplace';
  2.  

Getting Started

Inplace requires two child components having pInplaceDisplay and pInplaceOutput attributes to define the content of each state.

  1. <p-inplace>
  2. <span pInplaceDisplay>
  3. Click to Edit
  4. </span>
  5. <span pInplaceContent>
  6. <input type="text" value="PrimeNG" pInputText>
  7. </span>
  8. </p-inplace>
  9.  

Properties

NameTypeDefaultDescription
activebooleanfalseWhether the content is displayed or not.
disabledbooleanfalseWhen present, it specifies that the element should be disabled.
closablebooleanfalseDisplays a button to switch back to display mode.
stylestringnullInline style of the component.
styleClassstringnullStyle class of the component.

Events

NameParametersDescription
onActivateevent.originalEvent: Click eventActivates the content.
onDeactivateevent.originalEvent: Click eventDeactivates the content.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
ui-inplaceContainer element
ui-inplace-displayDisplay container
ui-inplace-contentContent container

Dependencies

None.

Source

View on GitHub

  1. <h3 class="first">Basic</h3>
  2. <p-inplace closable="closable">
  3. <span pInplaceDisplay>
  4. Click to Edit
  5. </span>
  6. <span pInplaceContent>
  7. <input type="text" value="PrimeNG" pInputText>
  8. </span>
  9. </p-inplace>
  10. <h3>Image</h3>
  11. <p-inplace>
  12. <span pInplaceDisplay>
  13. <span class="fa fa-picture-o"></span><span style="margin-left:8px">View Picture</span>
  14. </span>
  15. <span pInplaceContent>
  16. <img src="assets/showcase/images/demo/galleria/galleria5.jpg" alt="Nature">
  17. </span>
  18. </p-inplace>
  19. <h3>Data</h3>
  20. <p-inplace>
  21. <span pInplaceDisplay>
  22. <span class="fa fa-table"></span><span style="margin-left:8px">View Data</span>
  23. </span>
  24. <span pInplaceContent>
  25. <p-dataTable [value]="cars">
  26. <p-column field="vin" header="Vin"></p-column>
  27. <p-column field="year" header="Year"></p-column>
  28. <p-column field="brand" header="Brand"></p-column>
  29. <p-column field="color" header="Color"></p-column>
  30. </p-dataTable>
  31. </span>
  32. </p-inplace>
  33.