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
{{ message }}
This repository was archived by the owner on May 29, 2023. It is now read-only.
Is there a way to easily unsubscribe from Observable (geolocation service)?
When moving away from a component which uses geolocation service, I would like to stop observing the position. I couldn't find direct method to do that.
When I move back to the same component, it subscribes again and I have now two observers monitoring user position. If I do it again, I would have three observers firing at the same time with updated position.
Since I couldn't find direct solution, I used pipe with takeWhile, but it looks awkward.
The text was updated successfully, but these errors were encountered:
In this regard it is just the same as any other Observable. You can use async pipe in template to automate subscription, change detection and unsubscription. Or you can manually add takeUntil and use some destroy stream + ngOnDestroy.
🚀 Feature request
Is there a way to easily unsubscribe from Observable (geolocation service)?
When moving away from a component which uses geolocation service, I would like to stop observing the position. I couldn't find direct method to do that.
When I move back to the same component, it subscribes again and I have now two observers monitoring user position. If I do it again, I would have three observers firing at the same time with updated position.
Since I couldn't find direct solution, I used pipe with takeWhile, but it looks awkward.
The text was updated successfully, but these errors were encountered: