I think you got the pages right but I will iterate with my own words, page 1 is hosted in tab1 and page2 in tab2. Page1 is doing the following if there are on some URL parameters present
this.NavController.parent.select(1);
setTimeout(() => {
// INOTE: use ionic2 events to comm. from page to page
this.Events.publish("PlayersView:PlayAnyVideo");
}, 1000);
Page2 has the following in the constructor
// 20170430
this.Events.subscribe('PlayersView:PlayAnyVideo', () => {
console.log('PlayersView<<e------------PlayersView:PlayAnyVideo');
this.PlayAnyVideo();
});
Unlike push/pop, this.NavController.parent.select quit returning a promise back in some beta, so I am fudging some delay. There is an open bug report about .select by @mhartington himself https://github.com/driftyco/ionic/issues/8662
Because page2 is slow the first time, loading and initializing one of several players, it will miss this particular event, the first time. As you can see I am broadcasting an event to Page2 however it will miss it 30% of the time via this poor/unreliable construct.
Note: Once my main Pages in tabs are loaded, I do not want them to die and get recreated. That’s the reason I have stayed away from NavController.push/setRoot…, except for popping up a user preference page or such.
Perhaps, my poor understanding of Promises, leads me to believe they are appropriate here
to ensure that one thing happened .then do another, .then do another. (force/ensure a sequential execution, the fact that JS is single threaded vs other multi-threaded environment will remain beyond my domain. I accept to think most methods these days are non-block (async) by nature. I need a relatively simple construct/pattern to apply here and ti works) I see another reply again mentioning observables/subject please show me a snippet and I will apply it.
Going back to my simply wired mind, Page2 could set a .Ready flag true via a shared service also injected in Page1 but how to watch for it, the TS/Ion/Angular way, is still very blurred to me.
Thank you for trying to help.