问题标签 [angular-google-maps]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
580 浏览

angularjs - 无法让 angular-google-maps 工作

我是 MVC 和 Angular 的新手,我尝试按照 AGM 快速入门页面中的步骤来获取 angular-google-maps。Firebug 显示了几个错误,其中一些我不明白。

首先,我在访问下划线时得到 403。消息(减去 localhost)是:“NetworkError: 403 Forbidden - angular-oPast/app/..../node_modules/underscore/underscore-min.js” 为什么我无法访问我自己 PC 中的代码?

其次,我得到 SyntaxError: missing } after property list }; 对 ngLocale 有一些参考,这不在我的代码中。

第三,我得到 ReferenceError: _ is not defined with some reference to MarkerLabel,我没有使用它。

第四,我得到 [$injector:nomod] 模块 'residenceApp' 不可用!这是整个 Angular 应用程序的名称。尽管已经完成了一些教程,但我不知道如何构建它以使用 AGM 或将它放在哪里。

第五,根据 AGM QuickStart,我的 CSS 中有以下内容

这是一个难题,因为说明没有说明创建 HTML class=".angular-google-map-container" 我没有像那样放入 HTML 类属性,因为没有说明可以这样做。那 CSS 是做什么的,它对我的​​情况是否正确?

我使用 ng 的 HTML 看起来像:

在这一点上,其余的大部分 HTML 都是模拟文本。

我的脚本看起来像:

也许我应该说 AGM 的 example.html 在我的电脑上工作。所以我在系统中有必要的代码。它只是没有正确设置依赖项或其他东西。

我需要做些什么来解决这些问题并让 Google 地图正常工作?如有必要,我可以提供更多信息。

0 投票
1 回答
1004 浏览

javascript - angular-google-maps 中的标记与标记指令

我有一个非常非常简单的实现,使用指令在地图上放置大量标记。这是我的 HTML:

和我的 JS 的相关位:

如果我包含标记为 [2] 的 HTML 行,则会出现标记,但如果我包含标记为 [1] 的行,则不会出现。据我所知,它们应该具有完全相同的功能,这是一个非常简单的例子——这是一个错误还是我脑死了?

我正在使用 angular-google-maps 的 Bower 版本。

非常感谢。

0 投票
1 回答
769 浏览

angularjs - Issue with angular-google-maps windows directive

It's possible that I'm not understanding the scopes correctly, but I'm having problems getting some features of my implementation to work. One of which is explained here: https://github.com/nlaplante/angular-google-maps/issues/473

I basically get the model information in the windows directive without ng-non-bindable, which prevents ng-click from working. But my ng-click method needs the information from the model to work properly.

The other issue, which you can also see in the code example at that link, is that I need to essentially show two markers per marker - what I mean is, I need to show a "frame" and then the image for each marker, which are always going to be two separate images. Is there a way to accomplish this?

Added plunkr which demonstrates both problems: http://plnkr.co/edit/QJmHKBSV2XniqF6HX7FS?p=preview

You can see that the links within the window do not work properly (they won't deliver information from the scope because that scope is isolated ?), and the other problem is going to take a more creative approach, which is that I basically need to include two images with each marker.

0 投票
1 回答
867 浏览

javascript - 使用 angular-google-maps 指令在“grunt serve”期间有效,但在默认 grunt 任务期间无效

我正在使用 Yeoman AngularJS 生成器构建地图应用程序。我已经使用 bower 安装了 angular-google-maps。如果我使用“grunt serve”来测试应用程序,它可以正常工作并且地图可以正确加载。如果我只是发出“grunt”来构建应用程序,它会失败并说“模块'google-maps'不可用!您拼错了模块名称或忘记加载它。如果注册模块,请确保将依赖项指定为第二个论点。”

我不确定为什么它不适用于默认任务。我运行了“grunt bowerInstall”并确认 index.html 确实对 angular-google-maps 有正确的引用。我也在加载谷歌地图 API。

这是我的 app.js

0 投票
1 回答
1199 浏览

javascript - 使用 angular-google-maps 指令异步加载不工作

我正在使用 angular-google-maps ( http://angular-google-maps.org/ ) 在我的 AngularJS 应用程序中创建地图。在该<google-map>元素中,我有一个<markers>将模型属性设置为数组的元素,该数组是 $http.get 请求的结果。但由于某种原因,标记永远不会加载。

为了知道数据是否存在,我在地图旁边设置了一个带有 ng-repeat 的简单列表,以在返回结果时输出数组中每个元素的 id,它确实填充了列表,所以我不是确定使用<markers>指令时为什么不填充标记。是因为它们是从 $http.get 加载的,我需要做一些不同的事情吗?

这就是我目前正在做的从服务器获取数据的全部工作。Trucks 是一项具有查找器功能的服务。

我的 HTML 看起来像这样。

编辑 - 我阅读了更多文档,发现我需要添加 coords 属性 = 'self' 因为经度和纬度是模型本身的一部分,但标记仍然没有出现

谢谢。

0 投票
2 回答
476 浏览

angularjs - Google Maps AuthenticationService 拒绝在 AngularJS 应用程序中加载地图

在我的应用程序中实现 Angular Google Maps 时遇到了一些基本问题。
起初我以为这是我的应用程序代码,但这个 plunker 演示了同样的问题:

http://plnkr.co/edit/SWxqso?p=preview

这几乎就是此处的快速入门指南:http: //angular-google-maps.org/use并且由于某种原因,当请求地图文件时,我会使用 Google 的 AuthenticationService。

这似乎与 Angular 相关,因为应用程序之外的类似代码在没有 API 密钥的情况下运行良好。我已经尝试了我能想到的一切(包括添加我的 API 密钥和将我的域添加到我在 Google 的 API 控制台)。

这里还有另一个非工作版本:pitwall.csoutham.com/#/circuit/adelaide(没有足够的声誉发布两个以上的链接)。

非常感激地收到任何指导。

0 投票
1 回答
271 浏览

angular-google-maps - 开启时标记会出现/消失几次

我对标记指令有疑问。我首先加载它,但保持可见 = false。然后我打开它,集群出现,消失然后重新出现。这有时会重复几次。我尝试将 doRebuildAll 设置为 false,但是当将可见切换为 true 时它们根本不会出现。这是我对该指令的标记。我将它放在另一个指令中,这样我就可以保留不同类型层的列表:

和对象:

0 投票
1 回答
66 浏览

angular-google-maps - 打开信息窗口时地图平移和缩放

当我点击一个标记时,地图总是重新平移并缩放到初始状态。对于单个标记来说没什么大不了的,但是如果我从一个集群开始,放大然后单击一个标记,就会出现问题。它缩小,重新聚集,然后弹出窗口。有人遇到过这个问题吗?

这是它的样子: 在此处输入图像描述

以下是相关代码:

和标记。这是另一个指令,它允许我只保留不同图层类型的列表:

0 投票
0 回答
647 浏览

javascript - angular-google-maps 的 Windows 内部标记仅在从一开始就设置为可见时才有效

我正在使用 angular-google-maps 并且有一个应该都有信息窗口的标记列表。到目前为止,这是我的代码:

并在标记中:

当我showWindow从一开始就设置为 true 时,所有信息窗口都打开并且它们的行为正常,我可以关闭并再次打开它们。我不希望它们从一开始就全部可见,所以我设置showWindow为 false,但是现在当我单击标记时,什么也没有发生。该函数称为showWindow更新,但不显示任何窗口。

0 投票
1 回答
2678 浏览

javascript - 角谷歌地图窗口不显示

除了轮询之外,当我手动向地图添加点时,我无法显示窗口。只有预先填充了标记数组,它才会起作用。如果数组预先填充了 1 个标记,然后我在地图加载后手动添加第二个标记,则第一个标记将显示窗口,但第二个不会。这是具有不同纬度/经度的相同标记。据我所知,我的代码几乎与这个 plunker 相同,只是我没有轮询数据。

http://plnkr.co/edit/nbX0BIxNhxFrpzpruRWb?p=preview

我用于 luls 的个人网站。是的,我懒得得到一个真正的域名。它是免费的,好的 XD 证明了这个问题。不支持 IE 9 或更低版本。

这是控制器逻辑。

风景