Open popover at different location


I have a popover on my page which is positioned next to an element correctly when click it.
Now I have some special cases where I need to open the popover in other cases - when user did not click the element next to which it shall be opened.
Since I have no click event on that element now, how can I open the popover in the correct location?



Ok i could simulate a click on the element like below, which works, but seems very hacky… Better ideas welcome

    function simulateClick() {
	var cart = document.querySelector("#cart ion-icon");
	var rect = cart.getBoundingClientRect();
	console.log(, rect.right, rect.bottom, rect.left);
	var evt = new MouseEvent("click", {
		bubbles: true,
		cancelable: true,
		view: window,
		clientX: rect.left,,
		screenX: rect.left,

Yes, instead of passing the click event, create a fake event with the bounds of an element that you want to position it in relation with.

 let myEvent={
    getBoundingClientRect : () => {
              return document.getElementById("button").getBoundingClientRect();

 let popover = this.popoverCtrl.create(PopoverPage);
  myEvent: myEvent

It should work.