Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: support alternative forms of building a popover #23

Open
willshowell opened this issue Sep 19, 2017 · 5 comments
Open

Feature: support alternative forms of building a popover #23

willshowell opened this issue Sep 19, 2017 · 5 comments
Labels

Comments

@willshowell
Copy link
Contributor

  • component factory service
  • passing template ref
@rosslavery
Copy link

rosslavery commented Nov 18, 2017

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.

@willshowell
Copy link
Contributor Author

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?

@rosslavery
Copy link

rosslavery commented Nov 18, 2017

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.

@willshowell
Copy link
Contributor Author

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?

@rosslavery
Copy link

rosslavery commented Nov 18, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants