Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `lat;
- lng;
- getLocation() {
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(this.showPosition);
- } else {
- alert("Geolocation is not supported by this browser.");
- }
- }
- showPosition(position) {
- console.log("Latitude: " + position.coords.latitude +
- "Longitude: " + position.coords.longitude);
- this.lat = position.coords.latitude;
- this.lng = position.coords.longitude;
- console.log(this.lat);
- }`
Add Comment
Please, Sign In to add comment