问题标签 [agm-map]

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 投票
2 回答
622 浏览

angular - 如何动态呈现信息窗口内容

我正在使用 agm-direction 包在 agm-map ( https://www.npmjs.com/package/agm-direction ) 上显示路线信息。

我想知道如何渲染信息窗口的内容,尤其是原始标记:

标记选项

输出如下所示:

信息窗口输出

我想做这样的事情,所以我可以构建一个更复杂的信息窗口:

在此处输入图像描述

在此处输入图像描述

0 投票
1 回答
298 浏览

angular - How to reset the mapView if there is a dynamic content to be showed in the snazzy window popup?

How to reset the mapView if there is a dynamic content to be showed in the snazzy window popup?

When we open the snazzywindow modal on click of the marker it populates with details, for the first time the map view doesn't set properly to the complete view of the modal but when we open for the second time the map view adjusts to the full view of the popup

stackblitz URL of the problem: https://angular-tst926.stackblitz.io/

stackblitz code: https://stackblitz.com/edit/angular-tst926

Upon launching of the stackblitz url, click on one of the marker which is closer to the top of the browser, the intial popup will not have the content but after second based on the mock response the Modal populates with the right content but the full view of the modal is blocked, but when click once again on the marker to open the window it readjusts to the full view

based on the response of the API, the calculated content would be pasted on to the modal popup and subsequently the map view should readjust to show the full modal content at first time itself instead of clicking on the marker once again

**refer to the stackblitz: https://stackblitz.com/edit/angular-tst926 for the angular version and dependent versions **

0 投票
0 回答
350 浏览

angular7 - 角度 7 中的 agm-marker 未显示标签值

我在角度 7 中使用 angular-google-map 显示一些标记。但是标记的标签属性未显示该值。

m.count 未显示标记标签内的计数。

0 投票
0 回答
341 浏览

javascript - 如何动态添加航点

我想知道是否可以动态添加航点,然后在不刷新页面的情况下更新方向?

HTML

TS

}

0 投票
1 回答
1061 浏览

angular - 使用 MapsAPILoader 时无法解析参数 - Angular

我正在尝试按照下面列出的教程使用 Angular 8 实现自动完成功能。我已经在不同版本的 Angular 中多次实现了这个地理定位器自动完成功能,但是今天在 Angular 8 上我得到了错误:

使用 MapsAPILoader 时无法解析参数

教程

https://brianflove.com/2016/10/18/angular-2-google-maps-places-autocomplete/

我的代码:

如果我删除这一行:

错误消失

0 投票
1 回答
1311 浏览

javascript - Angular8 trackby 没有正确更新

所以首先有一点背景。我正在开发一个应用程序,它使用 agm 地图实时显示多个用户的位置。我最近一直致力于提高性能,因为可能有成千上万的用户,每个用户都代表一个地图标记或 dom 元素。我已将父组件和子组件更改为都使用 onpush 策略,子组件使用 ngFor 循环呈现地图标记,我还在此循环中添加了 trackBy。通过信号器接收位置更新,对象被正确更新,但即使在变化检测运行之后,标记位置也没有在地图上正确更新。

下面的两个组件是简化版本,以帮助识别问题。

首先是父地图组件

users 数组是通过订阅 http 服务来填充的,但我把它省略了,因为它工作正常。当接收到位置更新时,它由父级处理,我离开了函数来显示这一点,但通过订阅信号器服务再次调用该函数。

现在是地图标记组件。

我怀疑问题是由于 onpush 它没有检测到更改,但是出于性能原因 onpush 似乎是这种情况下的最佳策略。我只需要更新元素而不是重新绘制整个用户列表。但也许我让我的电线交叉,因为我对角度还是很陌生。感谢您的任何帮助或建议。

0 投票
1 回答
3507 浏览

angular - 试图删除或更改默认标记的图标在角度谷歌地图中

我正在实施角度谷歌地图,我从用户那里获取接送和目的地位置,并<agm-direction>在角度谷歌地图中显示方向。我已经在地图上显示了起点和终点的标记,但是在实施之后<agm-direction>它开始显示默认标记“A”和“B”。我想从地图中删除这些标记,或者将默认图标从“A”和“B”更改为其他图标。

0 投票
2 回答
1670 浏览

css - Agm 信息窗口自定义 css

我创建了一个带有图像和小文本(标题)的 agm-info-window:

这是结果:

在此处输入图像描述

我想更改信息窗口 css。- 背景颜色,删除关闭按钮(x)并将文本放在中心。像这样:

在此处输入图像描述

当我在 Chrome 的检查器中设置 CSS 时,我得到了正确的效果。我设置:

但是当我把这个相同的 css 放在组件 css 中时,它根本没有改变,什么都没有改变。

我没有太多的变化,所以我不想使用时髦的信息窗口。我只想对窗口进行这些小改动。可能吗 ?为什么css不工作?

0 投票
1 回答
324 浏览

javascript - How to use tilesLoaded in angular 8?

How to use tilesLoaded in agm angular google map. I want to do some action after map has fully loaded. Is there any example to use tilesLoaded in angular (v8)?

https://github.com/SebastianM/angular-google-maps/commit/d4f1371

0 投票
0 回答
1369 浏览

angular - 地图在强制刷新或鼠标点击之前不会更新

我正在使用地图来跟踪我的房车旅行期间的停靠点。因此,地图正在渲染折线和标记。这是html。

关于数据的组件没有什么花哨的。

我有一个 setCenter 函数,我会在所有数据更新后调用它。我已经添加了几个标记来查看边界是否已正确更新。为简洁起见,我没有添加该代码。

预期结果:添加标记和 p 线然后设置边界后,我希望地图能够更新并居中。

结果:在我将鼠标移到地图上并有时单击它之前,地图不会更新或移动。这会导致立即更新,所以我假设它没有陷入缓慢的功能。我还查看了调试器中的性能选项卡,看看它是否卡在某个地方。

尝试的事情:使用和ngIf隐藏然后显示地图,最新版本具有手动设置lat和lng以及缩放。尝试了不同的浏览器。