Created
March 28, 2020 13:33
-
-
Save LokeshSagi/ea4c38eab3887d0d480a53475269688d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="slds-grid slds-wrap"> | |
<div class="slds-col slds-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_12-of-12 slds-align_absolute-center"> | |
<button class="slds-button slds-button_brand" onclick={handleCurrentLocation}>Get my current | |
location</button> | |
</div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class CurrentLocation extends LightningElement { | |
handleCurrentLocation() { | |
navigator.geolocation.getCurrentPosition(success => { | |
this.showSpinner = true; | |
this.lat = success.coords.latitude; | |
this.long = success.coords.longitude; | |
console.log('lat -> ' + this.lat); | |
console.log('long -> ' + this.long); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment