popover icon indicating copy to clipboard operation
popover copied to clipboard

Feature: support alternative forms of building a popover

Open willshowell opened this issue 7 years ago • 5 comments

  • component factory service
  • passing template ref

willshowell avatar Sep 19 '17 19:09 willshowell

This is a big one for me. We have a large list of items, each with multiple popover triggers (think a table).

It would be nice to be able to use event delegation to register a single listener on the parent, and then open the popover with a service and position it based on the event.target for the captured click.

rosslavery avatar Nov 18 '17 20:11 rosslavery

It would be easiest (for now) to just support passing a popover instance to not have to duplicate the Input bindings in the service api. Are you thinking something like this would work?

@ViewChild('editPopover') editPopover;
@ViewChild('deletePopover') deletePopover;

openEditPopoverAt(targetEl) {
  this.satPopoverService.open(this.editPopover, {anchor: targetEl});
}

For your use case, is there any value difference in passing a popover instance vs. template ref vs. component class?

willshowell avatar Nov 18 '17 20:11 willshowell

My original motivation for wanting this was to keep the DOM as light as possible. So rather than having 4 sat-popover components per-row, each with their own click listeners, I would have 4 "dumb" icons in the DOM, then register a single listener on the parent.

Because of this, I suppose my ideal use-case would avoid needing to have the sat-popver in the DOM at all, and instead open the popover by just passing in a component class (similar to how MdDialog works.)

Edit: I understand these are just pie-in-the-sky discussions, and my ideas aren't necessarily simple to implement.

rosslavery avatar Nov 18 '17 20:11 rosslavery

Ahh I see. AFAIK a popover's content won't pollute the DOM until it's opened, but I understand not wanting 100s or 1000s of popover instances hanging around in memory until they're needed.

So effectively like MatDialog but with the ability to anchor to an element? It would return some popover ref that you could use to close it or whatever.

And out of curiosity, for this use case, would you need more than one popover open at a time?

willshowell avatar Nov 18 '17 20:11 willshowell

Yeah exactly. And you're right about the popover content not polluting. I'm just developing for some fairly performance constrained devices so every little bit counts ☺️

On Nov 18, 2017 3:48 PM, "Will Howell" [email protected] wrote:

Ahh I see. AFAIK a popover's content won't pollute the DOM until it's opened, but I understand not wanting 100s or 1000s of popover instances hanging around in memory until they're needed.

So effectively like MatDialog but with the ability to anchor to an element? It would return some popover ref that you could use to close it or whatever.

And out of curiosity, for this use case, would you need more than one popover open at a time?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ncstate-sat/popover/issues/23#issuecomment-345470165, or mute the thread https://github.com/notifications/unsubscribe-auth/AAoF9PMHJ8L3GAOw-U1KAuJapdmsnSi7ks5s30KogaJpZM4Pc43G .

rosslavery avatar Nov 18 '17 21:11 rosslavery