Unable to get geocoding for gMaps to work
stephcmartin opened this issue · comments
Hi Matt,
I ran through the setup guide for ember-cli-g-maps, first running ember install ember-cli-g-maps
, then adding
ENV.contentSecurityPolicy = {
'default-src': "'none'",
'script-src': "'self' 'unsafe-eval' *.googleapis.com maps.gstatic.com",
'font-src': "'self' fonts.gstatic.com",
'connect-src': "'self' maps.gstatic.com",
'img-src': "'self' *.googleapis.com maps.gstatic.com csi.gstatic.com",
'style-src': "'self' 'unsafe-inline' fonts.googleapis.com maps.gstatic.com"
};
and
ENV.googleMap = {
apiKey: '*my api keys*',
libraries: ['drawing', 'visualization']
};
I ran ember generate route google-search
and placed the following in my .hbs file:
In my .js file I have:
import Ember from 'ember';
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
lat: 42.75494243654723,
lng: -71.8359375,
zoom: 8
});
}
});
However, when I refresh the page, the map loads for around 2 seconds, then errors Oops! Something went wrong.
The console errors on chrome are:
common.js:47 Uncaught TypeError: Cannot read property 'prototype' of undefined
, js:59 Uncaught TypeError: Cannot read property 'data' of undefined
and Uncaught TypeError: b.match is not a function
.
I'm pretty sure I set up everything right. Is there something I'm missing?
@stephcmartin can you make a sample repo for me to debug using your exact code?
@Matt-Jensen My whole repo is here: https://github.com/stephcmartin/waldo/tree/google/app
The .hbs file is here:
https://github.com/stephcmartin/waldo/blob/google/app/templates/google-search.hbs
The .js file is here:
https://github.com/stephcmartin/waldo/blob/google/app/routes/google-search.js
Hey Steph, I'm playing with master right now and I'm not seeing ember-cli-g-maps
added to the project. Is there a specific branch I should be using?
Hi Matt, just tried starting it from scratch and it's on the 'g-maps' branch.
My package.json file is here, it has the package installed.
The google-search.hbs is in waldo/app/templates/google-search.hbs, and the .js script is in waldo/app/routes/google-search.js
The route is
this.route('google-search', {path: 'location/search'});
, so if you fork and clone it, you can run it at http://localhost:7165/location/search.
Sorry for not being specific - and thank you for investigating :)
Thanks for that Steph, however seems to be working fine for me:
Chrome: 61.0.3163.100
ember-cli: 2.16.2
node: 6.11.5
os: darwin x64
However I see you have "ember-cli": "^2.10.0"
specified in your package.json file, are your existing dependencies a similar version to mine? However if this issue is resolve by migrating your project to the latest ember-cli that could be a good solution, because I'm not sure I'm even testing on 2.10 anymore.
Hi Matt,
I ran an update and it works! Thank you so much!
I just followed the instructions on this page.
Best,
Steph