When I keep adding pages to navigation stack, more and more instances of SimpleComponent class are created. For this reason I subscribe more than once to “ev” event and fire code more than once.
You can check that by going “there” and “back” in my plunker example and firing event in different situations (check console warnings for results). You can also see that even when you move back to the top of the navigation stack, you still have your subscription.
ionViewWillLeave is not working probably because it’s not the actual view that I’m leaving
I wonder what should I do in order to avoid that? I want the SimpleComponent to be included like old-style AngularJS directive as I use it in my application many times.
Here is plunker
Here you can find related stack overflow topic
Solved: I moved most important code responsible for handling after-event-received action to @Injectable and it solved issue