Background
A ionic app with menu and two pages (Home
and list
).
Home
page subscribes an event on ionViewWillEnter
and unsubscribes it on ionViewWillUnload
.
Correct situation:
Start app with Home
and the event subscribed.
If toggle menu and click List
from Home
, the event unsubscribed.
Re-enter Home
and the event subscribed.
Wrong situation:
App started with Home
and event subscribed.
Toggle menu > click Home
>
Console:
event subscribed
event unsubscribed
Result is the event unsubscribed on Home
page.
Desire situation
Enter Home
(from other page / re-enter from menu) > subscribe event once.
Leave Home
(to other page / re-load same page from menu) unsubscribe event once.
Playground
ionic-menu
I expect the enter and unload come with pair.
If re-entering same page, unload should runs before enter.
However, it’s not the case.
Please suggest a way for proper (un)subscribe event in ionic
Thanks.