Created
May 25, 2013 18:05
-
-
Save Pent/5650108 to your computer and use it in GitHub Desktop.
geolocation in meteor
This file contains hidden or 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
| client.js ------ | |
| if (navigator.geolocation) { | |
| navigator.geolocation.getCurrentPosition(function(position) { | |
| Session.set('lat', position.coords.latitude); | |
| Session.set('lon', position.coords.longitude); | |
| }, function(error) { | |
| }, { enableHighAccuracy: true }); | |
| } | |
| Template.userLayout.location = function () { | |
| return Session.get('lat') + " : " + Session.get('lon'); | |
| }; | |
| app.html ------ | |
| <template name="userLayout"> | |
| <div>{{location}}</div> | |
| </template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment