没有显示谷歌的角度,地图 [英] Angular google-maps not displayed

查看:99
本文介绍了没有显示谷歌的角度,地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序中,我有一个拼车模块。现在我想显示在地图上,你就可以看到,接近你的合伙用车。但是,地图将不会显示。

I'm creating an app in which I have a carpooling module. Now I want to display a map on which you'll be able to see carpoolers that are close to you. However, the map won't show..

我使用的是伪指令

http://nlaplante.github.io/angular-google-maps/

我已经添加了谷歌,映射到我的依赖和指令通过谷歌地图所取代,但它并没有显示任何东西。

I've added the google-maps to my dependencies and the directive is replaced by a google map, but it doesn't show anything.

我有这个指令在我看来:

I've got this directive in my view:

<google-map center="center" 
        zoom="zoom" 
        markers="markers" 
        style="height: 400px; width: 100%; display: block;">
</google-map>

我在我的控制器中的所有变量:

I have all the variables in my controller:

 $scope.center = {
        latitude: 45,
        longitude: -73
    };
    $scope.markers = [];
    $scope.zoom = 8;

当我打开Firebug,我收到以下错误:

When I open firebug, I get following error:

Error: [$compile:multidir] Multiple directives [googleMap, markers] asking for new/isolated scope on: <google-map class="ng-isolate-scope ng-scope" center="center" zoom="zoom" markers="markers" style="height: 400px; width: 100%; display: block;">

我试过了很多东西,并寻找解决方案,但没有固定我的问题。是否有任何人能帮助吗?

I've tried a lot of things and searched for solutions, but none fixed my problem. Is there anyone that can help?

在此先感谢。
HS。

Thanks in advance. HS.

推荐答案

我觉得你有两个问题:


  1. 标记

  1. Markers

&LT;谷歌地图中心=中心变焦=放大可拖动=真&GT;
        &LT;标记模式=标志COORDS ='几何'&GT;&LT; /标志物GT;
 &LT; /谷歌地图&GT;

在哪里几何就是你得到了坐标的财产。如果标记是坐标本身可以设置COORDS ='自我'

Where 'geometry' is the property where you got the coordinates. If the markers are coordinates as themselves you can set coords="'self'"

风格:不需要在指令设置地图样式。而不是你需要指定一个CSS样式

Style: Don't need to set the map styles at the directive. Rather than that you need to specify a css style

.angular - 谷歌地图容器{
    高度:700像素;
 }

这篇关于没有显示谷歌的角度,地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆