You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I refresh page all things is okay, but when I switch to another page and come back to chat page $scope.arr not null and last data array in listener is exist.
What should I do for null array after come back to chat page (just on listener block)?
The text was updated successfully, but these errors were encountered:
I have problem like this ^
I have controller with chatSocket handler: chatSocket.on('message', (data) => console.log);
First time console.log work only once.
But when i change routes, e.g. /chat -> /main -> /chat
Now my handler work TWICE.
Should i use chatSocket.removeAllListeners() before enter the /chat or ... ?
@essivision, I just remove listeners before scope destroyed on state change.
In angular 1.5+ i use: this.$onDestroy hook (https://docs.angularjs.org/guide/component)
In this hook i just write chatSocket.removeListener('message');
Hi,
I defined a service like this:
and in controller:
when I refresh page all things is okay, but when I switch to another page and come back to chat page
$scope.arr
not null and last data array in listener is exist.What should I do for null array after come back to chat page (just on listener block)?
The text was updated successfully, but these errors were encountered: