nohros / nsPopover

Popover dialogs for angularjs applications.
MIT License
126 stars 107 forks source link

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

Open viruletdew opened 9 years ago

viruletdew commented 9 years ago

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 commented 9 years ago

I think you can solve it by using event broadcast.

viruletdew commented 9 years ago

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 commented 9 years ago

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