PrimeNg OverlayPanel with custom template param

Viewed 518

I'm trying to figure out if it is possible in any way to pass a custom parameter to the overlayPanel of PrimeNg.

It should look something like this: (notice the let-item param in the ng-template)

<p-overlayPanel #op>
    <ng-template pTemplate let-item>
        <div (click)="this.delete(item.id)">
            {{item.name}}
        </div>
    </ng-template>
</p-overlayPanel>

The reason I'm trying to do this is because I'm opening this panel from each list item in my UI, and I need a reference to the item that the panel was opened from.

Thanks

1 Answers

I was trying to figure out the same scenario. As long as you can reference item, I got it working by removing the ng-template element:

<p-overlayPanel #op>
    <div (click)="this.delete(item.id)">
        {{item.name}}
    </div>
</p-overlayPanel>
Related