Hi Sander,
I am maintaining a WebSocket connection in the background. I send a start
consuming message to the server for each path I wan't to listen for
updates. I have to clean up all listeners when a $scope destroys, so I can
send the stop consuming message when no one cares about a path any more. I
could archive this by writing in each controller $scope.$on('$destroy',
function(){self.updatingObject.done()}), or I can pass the $scope to the
service each time. I wan't to have the easiest API for the service, because
what if someone forgets to write the clean up logic. That's why I thought
to write this in one place.
Andras
On Thursday, 11 June 2015 08:09:43 UTC+2, Sander Elias wrote:
>
> Hi András,
>
> There are some ways to do what you ask, but first, why would you want to
> do this? Do you have some kind of memory leak?
>
> Regards
> Sander
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.