I’m working on in-app chat and Im using Socket. Basically, I use the ion tabs template and the workflow is similar to whatsapp : I have a list of conversations and if the user tap on one, it display the full conversation.
When I receive a message, I trigger $rootscope.$emit event on my socket factory and receive the event on the controller which deals with the whole conversation. It appears that if the user see the conversation #1, then go back to the conversation list (using $ionicHistory.goBack() ) and see the conversation #2, the controller of conversation #1 is still activated and it kills my code logic.
I tried to set the cache to false about the state but it doesn’t work.
What should I do to avoid this ? In other words, how to avoid keeping previous controller activated ?