Ionic 3 trigger Popover from another button?

2628 views angular
6

Is it possible to trigger a popover in Ionic 3 using a secondary button?

For example I want my popover to be bound to this button.

<button ion-button
       (click)="presentPopover($event)">
    BUTTON 1 
</button>

but also want to trigger that popover from another button.

<button ion-button icon-only 
       (click)="clicking this fires button 1">
    <ion-icon name="more"></ion-icon>
BUTTON2
</button>

Any idea how this is possible?

answered question

Yes you can but popover always shows in center of screen when you open it using second components

1 Answer

10

You can to simulate click-event for BUTTON 1 on click BUTTON 2

<button **id="btn1"** ion-button (click)="presentPopover($event)">
    BUTTON 1 
</button>

<button ion-button icon-only (click)="clicking this fires button 1">
    <ion-icon name="more"></ion-icon>
    BUTTON2
</button>

posted this

Have an answer?

JD

Please login first before posting an answer.