Couple suggestions:

Your $scope.localStream isn't used, you seem to be storing the stream in normal 
js vars. You can remove it from scope.

Perhaps you should consider a stream (Angular) service, instead. It would be a 
singleton and so you would always know whether you have the stream or not. If 
you deal with multiple streams then it could become a stream cache service 
where you could ask for a stream by name.

Finally, I would not watch a function to test whether the location has changed. 
Instead, I believe that the router can tell you via an event when the location 
changed, so just wire up an event handler to get notified when you should 
destroy the stream.

I got this helps.

Steve

-- 
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.

Reply via email to