Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4837

Best way do use Google Maps API in Ember

$
0
0

@MarcManhart wrote:

Im wonderin what is the best way (based on your experiences) to use GMaps in your projects.

My current (working) approach is to load the gmaps-script in the index.html like this:

...
<script async defer src="https://maps.googleapi..."></script>
</head>
<body>
  {{content-for 'body'}}
...

and use the api within my own component "map-view" like this:

files

_components
 |_map-view
   |_components.js
   |_template.hbs

content

import Ember from 'ember';

export default Ember.Component.extend({

  didInsertElement: function() {
  ...
  var map = new google.maps.Map(maptag, options);
  this.set('map', map);
  ...
  }
});

I know there is a plugin out there, but ive got no good feeling using modules instead of doing it on my own way. Especially if they are using an existing library in an "mapping" way. But maybe you would say that this is the better way like my approach.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4837

Trending Articles