Guest User

Untitled

a guest
Mar 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. `lat;
  2. lng;
  3. getLocation() {
  4. if (navigator.geolocation) {
  5. navigator.geolocation.getCurrentPosition(this.showPosition);
  6. } else {
  7. alert("Geolocation is not supported by this browser.");
  8. }
  9. }
  10.  
  11. showPosition(position) {
  12. console.log("Latitude: " + position.coords.latitude +
  13. "Longitude: " + position.coords.longitude);
  14. this.lat = position.coords.latitude;
  15. this.lng = position.coords.longitude;
  16. console.log(this.lat);
  17. }`
Add Comment
Please, Sign In to add comment