Skip to content

Instantly share code, notes, and snippets.

/application.js Secret

Created December 4, 2017 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5e7fb5f134fe2b55cd8832e0ad4a41b9 to your computer and use it in GitHub Desktop.
Save anonymous/5e7fb5f134fe2b55cd8832e0ad4a41b9 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import { A } from "@ember/array"
const { computed } = Ember;
export default Ember.Controller.extend({
mongoData: {},
randomVariable: 111,
locArray : [],
addressQuery: 'SF, Lafayette Park',
addressQueryInput: computed.reads('addressQuery'),
routeColor: 'red',
showingAllPolylineCoords: true,
customOptions: computed(function() {
if (google) {
return { mapTypeId: google.maps.MapTypeId.TERRAIN };
}
}),
actions: {
refresh() {
this.set('randomVariable', Math.floor(Math.random() * 1000));
}
pullMongoDBData() {
this.getCityCoords_(['Paris', 'Lille', 'Lyon', 'Bordeaux', 'Brest'], this);
}
},
getCityCoords_ : (cityName, this_) => {
console.log('input : ' + cityName)
cityName.forEach( (city) => {
Ember.$.get('https://maps.googleapis.com/maps/api/geocode/json?address=' + city + '&key=XXXXXX', (result) => {
let myLocation = result.results[0].geometry.location;
this_.locArray.push(myLocation);
});
});
console.log('this.locArray : ' + (this_.get('locArray')));
this.set('locArray', (this_get('locArray')));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment