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

Add callbacks for when a popover is opened or closed. #100

Merged
merged 2 commits into from
Aug 19, 2015
Merged

Add callbacks for when a popover is opened or closed. #100

merged 2 commits into from
Aug 19, 2015

Conversation

gabehayes
Copy link
Contributor

Currently, it appears that there are two ways to hook into the opening of a popover.

  1. Use the ns-popover-angular-event, which will open the popover when the given event name is broadcasted on the $rootScope. You can listen to that event elsewhere and know that when it is called, the popover was also told to display.
  2. Use the ns-popover-scope-event, which will open the popover when the given event name is broadcasted on the $scope. As with angular-event, you can listen for that event and respond accordingly.

The problem with the two approaches above is that sometimes there are many popovers on the same scope, so unless you are using group ids, you may be triggering numerous popovers to display when you had only wanted to open one.

To remedy this, both ns-popover-angular-event and ns-popover-scope-event should parse the passed in values, so that you could bind to an event such as some:event:{{ some.id }}.

I found that this was a level of complexity that was beyond what I was looking to do.

Really, I just wanted to run callback methods when the associated popover was either opened or closed.

These proposed changes introduce the following attributes:

<div ns-popover
     ns-popover-on-open="onPopoverOpen()"
     ns-popover-on-close="onPopoverClose()"
></div>

The callbacks will be executed when the respective popover's displayer_.display or hider_.hide methods are called.

nohros added a commit that referenced this pull request Aug 19, 2015
Add callbacks for when a popover is opened or closed.
@nohros nohros merged commit c444ad0 into nohros:master Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants