Google 地点自动完成未出现

Google Places Autocomplete not appearing

组件

import Ember from 'ember';

export default Ember.TextField.extend({
type: 'text',

didInsertElement: function() {
  this.$().addClass("form-control");
  var autocomplete = new google.maps.places.Autocomplete(
    (document.getElementById('autocomplete')),{types:['geocode']} //trying without jQuery, but still.
  );
}});

模板

{{gp-textfield id="autocomplete"}}

呈现给

<input id="autocomplete" type="text" class="ember-view ember-text-field form-control" placeholder="Enter a location" autocomplete="off">

但我仍然得到:

InvalidValueError: not an instance of HTMLInputElement

任何帮助将不胜感激。

编辑:Ember 2.6

稍微清理了一下代码,但没有用

didInsertElement: function() {
  this.$().addClass("form-control");
  var element = document.getElementById('autocomplete');
  var autocomplete = new google.maps.places.Autocomplete(element);
}

在 chrome 中使用了“网络”选项卡。

显然我的 API 密钥未被授权使用此功能,我必须启用它。