I want to set margin-top and margin-left position for primeNG overlay panel dynamically. How to achieve this?
Asked
Active
Viewed 4,036 times
1 Answers
3
You can achieve that with the tag [style] in your html:
<p-overlayPanel [style]="marginStyle">
</p-overlayPanel>
and declaring the margin that you want in the .ts like this:
positionLeft = '90px';
positionTop = '20px';
marginStyle = { 'margin-left': this.positionLeft , 'margin-top': this.positionTop };
You can check the live example here: https://stackblitz.com/edit/primeng-overlay-position-style

Daniel Piñeiro
- 3,009
- 1
- 16
- 26
-
This answer helped me to set style for overlayPanel – israel Jan 20 '20 at 11:52