angular-strap icon indicating copy to clipboard operation
angular-strap copied to clipboard

Popover open and close events/callbacks

Open RyanP13 opened this issue 11 years ago • 7 comments

Hi,

I have a dynamic data grid that updates periodically with fresh data.

When the cells are clicked then we display some options in a popover.

We re-render the entire grid on an update which then closes the popover if open.

I can add a persistence layer to say if the user has opened a popover then keep it open but I see no event hooks to tell if a popover has been opened or closed.

I use $scope.$watch in my directive's link function to look for the amount of child nodes present, which tells me if a popover is open. But with autoclose set to true i cannot see where i can listen for when the popover is closed or not.

RyanP13 avatar Apr 07 '15 07:04 RyanP13

Lack a trigger onHide,...

Into $modal.hide, we can add the trigger, and use the options to set the callback.

augustoeliezer avatar Apr 07 '15 13:04 augustoeliezer

In my case I need a trigger to block the aside close.

Something like:

onHiding = function() { //false not hide return value === 'rule'; }

augustoeliezer avatar Apr 07 '15 14:04 augustoeliezer

Try using

$scope.$on('tooltip.show', ...)

Popover uses tooltip internally, so you should have the tooltip events available:

  • tooltip.show.before
  • tooltip.show
  • tooltip.hide.before
  • tooltip.hide

vmlf01 avatar Apr 07 '15 16:04 vmlf01

Thanks. That's exactly what i needed.

RyanP13 avatar Apr 08 '15 01:04 RyanP13

Thanks, works for me too. Example blocking aside:

$scope.$on('aside.hide.before', function (e) { if (block_aside_close) e.preventDefault(); }

augustoeliezer avatar Apr 08 '15 17:04 augustoeliezer

I was checked this at yesterday, but it was not worked for me. (I wanted to use aside.hide.before)

  • the scope was same in the opener and watcher function
  • I have not found any code about this in the source (but I could miss)

Thx for help!

andras-tim avatar Sep 22 '15 09:09 andras-tim

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 26 '19 02:01 lock[bot]