3

我有这个结构:

  • 我的文件夹
    • myApp.coffee
    • 索引.html
    • 搜索框.tpl.html

在 myApp 设置中:

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

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

4

2 回答 2

4

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

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

<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
    });
}]);
于 2016-03-06T03:00:48.380 回答
3

必须包括图书馆=地点

<script src='//maps.googleapis.com/maps/api/js?libraries=places&sensor=false&language=pt&v=3.17'></script>
于 2015-03-12T13:53:42.820 回答