An example that uses the Ionic "utils" classes (here, DomUtil):
var nodeClass = 'target-host-item-class'; var evtTarget = $event.target; var hostNode = ionic.DomUtil.getParentOrSelfWithClass(evtTarget, nodeClass); $ionicPopover.fromTemplateUrl('popover-template.html', { scope: $scope }).then(function(popover) { popover.show(hostNode); });
Not really worse or better than the other answers. Just avoids using direct DOM or jQuery queries.
Here I want the popover to always align with the element using the .target-host-item-class .
source share