4 | Angular does not have any built-in instruments to use
5 | Geolocation API. This is an Observable based
6 | abstraction over Geolocation API to use with
7 | Angular
8 |
16 | Usage is pretty simple: just import service in your component and subscribe to
17 | it. Service extends Observable and will emit the
18 | Position object.
19 |
22 | {{sample}}
23 |
24 |
25 | You also can use async pipe
26 | 27 |
28 | {{sampleAsync}}
29 |
30 |
31 |
52 | If you need to get position just once and stop observing user location,
53 | you can subscribe to geolocation$ and use take(1) RxJs
54 | operator. Service is cold, meaning if there are no Subscribers, it doesn't
55 | track position
56 |
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)