Dismiss Ionic 4 popover from its component
add private popoverController: PopoverController
to the component constructor
then write a function like this and call it when you want to dismiss the modal
async DismissClick() {
await this.popoverController.dismiss();
}
I solved this problem as follows: In parent component I have passed callback as prop to child component:
const popover = await this.popoverController.create({
component: PopoverComponent,
event: ev,
componentProps: {
onClick: () => {
popover.dismiss();
},
},
});
await popover.present();
And in PopoverComponent I have added @Input() onClick;
which called when the user clicks:
...
@Input()
public onClick = () => {}
...
afterClick() {
this.onClick();
}