Alternative to Popover

Hi All,

I am currently having a problem implementing a Popover that works correctly. Please see this if you want more details. I suspect there may be a bug in the Popover code that is breaking the navigation.

As a result of lots of head scratching with no success, I have decided to investigate if Ionic 2 offers any alernatives to Popovers that offer similar functionality.

Does anyone have some advise please?

Thanks

Hi,

I don’t think that the popover is your problem in this case but that you try to submit some data with your popToRoot(options) statement. If I read the docs correctly the options parameter is only to define details of the pop transition back to the root page, not to contain any additional data.

In your case I would use ionic’s Event system to submit the data from your MapPage back to your SearchPage just before returning back to it:

In your MapsPage:

 let data = {
    employeeModel: this.employeeModel
  };
events.publish('employee:update', data);
this.nav.popToRoot();

In your SearchPage constructor:

events.subscribe('employee:update', (data) => {
//do whatever you need to do with your data:
  let myEmployeeModel = data[0].employeeModel;
});

Thank you sZerner. That looks like it will work. I appreciate the help. I will implement it when I’m back at my pc.

I do need to reload the page with the parameters back from the mapPage. Hopefully the event subscription gives me a hook to do so.

I guess the behaviour I want is exactly what this forum page is doing, so it should work.

Hi sZerner,

I just tried it. It works. Thank you for your help.