Open popover from controller?

I’ve used popover in my app when a users clicks on something, that way I can provide an $event that seems to be required:

$scope.openPopover = function($event) {
    $scope.popover.show($event);
  };

I’m now trying to open a popover from my controller (after a user has taken an action with the barcodescanner plugin) and I don’t have an $event variable since a user isn’t clicking.

Why do I need to provide an $event variable in order to open the popover? Is there a way to open a popover from the controller instead?

Thanks!

hi @jorre,

u inste of event add an element like

angular.element(document.querySelector('#elementId'));
1 Like

Thanks, so it needs an element, not really a click event?

I’ve now solved it by inserting a click event that is triggered when my camera gets opened. That same event is then passed to the popover later on and works. Thanks for helping out.

Hi @jorre care to share some snippet from your controller - I’m trying to achieve something similar for when the hardware menu button is tapped.

Did you end up with something like below?

``angular.element(document.querySelector(’#myButtonId’)).click();

Thanks