Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get latest location in ApplicationController
- Loading branch information
Showing
4 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
App.ApplicationController = Ember.Controller.extend({ | ||
updateLocation: function() { | ||
// TODO really should wait for deviceready event before calling this | ||
// document.addEventListener('deviceready', this.trulyUpdateLocation, false); | ||
navigator.geolocation.getCurrentPosition(this.geoLocation, null, {enableHighAccuracy: true}); | ||
}, | ||
geoLocation: function(location){ | ||
Ember.set(App, 'latitude', location.coords.latitude); | ||
Ember.set(App, 'longitude', location.coords.longitude); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
App.CampsitesController = Ember.ArrayController.extend({ | ||
sortProperties: ["distance"], | ||
|
||
updateLocation: function() { | ||
// TODO really should wait for deviceready event before calling this | ||
// document.addEventListener('deviceready', this.trulyUpdateLocation, false); | ||
navigator.geolocation.getCurrentPosition(this.geoLocation, null, {enableHighAccuracy: true}); | ||
}, | ||
geoLocation: function(location){ | ||
Ember.set(App, 'latitude', location.coords.latitude); | ||
Ember.set(App, 'longitude', location.coords.longitude); | ||
} | ||
sortProperties: ["distance"] | ||
}); |
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