ember-cli-geolocation
Addon provides property into routes and controllers to get geo-location information (e.g. coords.)
Installation
npm install --save-dev ember-cli-geolocation
ember generate ember-cli-geolocation
Usage
Available as mixin, you can use like that:
import Ember from 'ember';
import GeoLocationMixin from 'ember-cli-geolocation/mixins/geolocation-mixin';
export default Ember.Controller.extend(GeoLocationMixin, {
init: function() {
this._super();
this.get('geolocation').start();
setInterval(Ember.run.bind(this, function() {
console.log(this.get('position'));
}), 1000);
self.get('geolocation').on('change', function(geoposition){
console.log(geoposition);
});
self.get('geolocation').on('error', function(){
console.log("SOME ERR");
});
this.get('geolocation').getGeoposition().then(function(geoposition) {
console.log(geoposition);
});
setInterval(Ember.run.bind(this, function() {
this.get('geolocation').stop();
}), 30000);
}
});
Running
Running Tests
ember test
ember test --server
Building
For more information on using ember-cli, visit http://www.ember-cli.com/. Addon based on geoPosition.