gpt4 book ai didi

angularjs - Angular-google-maps 搜索框

转载 作者:行者123 更新时间:2023-12-03 08:13:29 24 4
gpt4 key购买 nike

我有这样的结构:

  • 我的文件夹
    • myApp.coffee
    • index.html
    • searchbox.tpl.html

在 myApp 设置中:

$scope.searchbox = {template: "searchbox.tpl.html"}

我正在使用这个 example但是我得到了 TypeError: Cannot read property 'SearchBox' of undefined,这可能是什么?

最佳答案

您可以通过两种方式使用 angular-google-maps:

1) 通过在 angular-google-maps 之前包含 API。
...在这种情况下,您需要以这种方式包含库 places:

<script src='//maps.googleapis.com/maps/api/js?libraries=places&sensor=false&language=pt&v=3.17'></script>
^
see? there

2) 通过使用.config(推荐)。
...在这种情况下,您需要以这种方式包含库 places:

angular.module('myApp').config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: 'your api key',
v: '3.20', //defaults to latest 3.X anyhow
libraries: 'places,geometry,visualization' // <--- see? there
});
}]);

关于angularjs - Angular-google-maps 搜索框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29010994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com