mercredi 22 avril 2015

using google autocomplete in ember.js

I'm trying to use the Autocomplete api from google in my ember.js App

My view:

import Ember from 'ember';
import autocomplete from '../utils/google-geocoder-autocomplete.js';

export default Ember.View.extend({
  templateName: "mapLocation",
  classNames: ["map-location"],
  autocomplete: function() {
    autocomplete($(".map-location-search-input-2")[0]);
    console.log(autocomplete);
  }.on('didInsertElement')
});

My autocomplete function:

export default function googleGeocoderAutocomplete(input) {
    var autocomplete = google.maps.places.Autocomplete(input);
  return autocomplete;
}

I've added a break in the function, here are the values:

input:

<input class="map-location-search-input-2" type="text">

When calling the Autocomplete, I get that error:

TypeError: this[Lb] is not a function

...,b){gg("places_impl",S(this,function(c){this[Lb](b||{});c.Jl(this,a)}))}P(Hl,U);...

The error comes from the places API so I guess I am loading correctly the service.




Aucun commentaire:

Enregistrer un commentaire