加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – Angular-google-maps搜索框

发布时间:2020-12-17 07:08:48 所属栏目:安全 来源:网络整理
导读:我有这个结构: myFolder myApp.coffee index.html searchbox.tpl.html 在myApp设置中: $scope.searchbox = {template: "searchbox.tpl.html"} 我正在使用这个example,但我得到了TypeError:无法读取未定义的属性’SearchBox’,可能是什么? 解决方法 您可
我有这个结构:

> myFolder

> myApp.coffee
> index.html
> searchbox.tpl.html

在myApp设置中:

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

我正在使用这个example,但我得到了TypeError:无法读取未定义的属性’SearchBox’,可能是什么?

解决方法

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

1)在angular-google-maps之前加入API.
…在这种情况下,您需要以这种方式包含库位置:

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

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

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
    });
}]);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读