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

Conflict with ns-popover-modal and ns-popover-hide-on-outside-click #81

Open
viruletdew opened this issue Apr 8, 2015 · 3 comments
Open

Comments

@viruletdew
Copy link

Hi,

I have 3 buttons on a page. When the user clicks a button, I want to show the popover associated with that button. I also need to keep the popover open even if the user clicks outside of it - unless clicking on another button that triggers a popover.

I think I am supposed to use both ns-popover-hide-on-outside-click='false' along with ns-popover-modal="true". Unfortunately, what occurs is multiple popovers rendering on the screen, with each button click.

Is this a conflict?

Is there a way to trigger all popovers to close before showing the chosen one, when clicking a triggering button? hidePopover is only usable within the popover template.

Thanks for any help!

@nohros
Copy link
Owner

nohros commented Apr 9, 2015

I think you can solve it by using event broadcast.

@viruletdew
Copy link
Author

Thanks. I tried adding the following to my directive. It doesn't seem to work though. Popovers still open without closing the others.

$scope.myf = function(index) {
$scope.$broadcast('answered'+index);
}

My buttons html:
ng-click="myf($index)"
ns-popover
ns-popover-template="popover.html"
ns-popover-placement="top|center"
ns-popover-theme="ns-popover-mytheme"
ns-popover-hide-on-click="false"
ns-popover-modal="true"
ns-popover-hide-on-outside-click="false"
ns-popover-scope-event="answered{{$index}}"
ns-popover-timeout="1000"

@viruletdew
Copy link
Author

Is my (above) code the proper way of implementing the broadcast event for the popover?

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

No branches or pull requests

2 participants