问题标签 [angularjs-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 投票
1 回答
1705 浏览

javascript - angularjs-google-maps - info-window does not work with ng-repeat

I use google maps with ng-map and use markers and info-windows attached to these markers added to the map with ng-repeat. My angular view is the following:

the myMarker.infoWindowId correspond to infoWindow.id and myMarker.id to infoWindow.markerId. There seems to be no issue in that, the markers and the infowindows are listed just fine in the DOM after loading the view and controller.

The markers are shown just fine on the map, as they are updated when the on-bounds_changed="getLocations()" function is executed.

The list of info-windows is updated in getLocations() too, the markers and the info-windows can be seen in the DOM, but the info-windows are not shown when I click on the corresponding marker. Tried using a single info-window item in the view and update its content when the user clicks on a marker, but nothing changed.

Can anyone please point me in the right direction to what am I not doing right here? Thank you.

A second question: if I must use ng-non-bindable in the info-window content (ng-map complains otherwise), how can I dynamically update/generate the content of the info-window? But this issue should show up only after the infow-windows are shown.

0 投票
0 回答
375 浏览

javascript - 如何根据其大小调整谷歌地图的中心?

我想展示印度的中心。地图的大小根据要求而变化。我的问题是当地图缩小时,它没有显示印度的中心,请参见以下代码:

我想将印度地图居中 latitude: 21.0000, longitude:78.0000,但它不起作用。请看下图。scope.addLandMarkForm将地图的大小减小 50% 并将印度地图的中心放在上述坐标处,我可以减小大小但无法将上述坐标设置为印度的中心

$scope.closeForm 将关闭表单,地图将返回原始表单。

请看以下图片:

地图中心不正确:
地图中心不正确

正确的地图中心:
正确的地图中心

正如Bruno César所建议的,我需要一些窗口 DOM 甚至监听器,它能够监听 DOM 的变化。我怎样才能在这里使用它?我正在通过document.getElementById('IndiaMap').className='col-md-6';哪种类型的事件更改 CSS 类?

0 投票
2 回答
367 浏览

angularjs - NgMaps 中心不工作(动态点)

我在我的 Angular 应用程序中使用 NgMaps

我正在尝试动态地给出中心点,但它占用了我没有给出的其他一些点:

HTML:

在控制器中:

这是 Plnkr 代码:

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

0 投票
1 回答
845 浏览

google-maps-markers - 使用 angularjs 谷歌地图点击标记的自定义信息窗口

我正在使用 angularjs 谷歌地图,我想自定义样式显示在标记单击上的 infoWindow。ui-gmap-window 标签确实有自定义选项,它可以独立工作。但是,当我尝试在标记标记(ui-gmap-markers)中使用它时 - 它不会在标记单击时显示自定义样式的 infoWindow。plunkr清楚地解释了这个问题。

http://plnkr.co/edit/Mif7wX1eEkwtfAQ93BCI?p=info

0 投票
3 回答
10395 浏览

angularjs - 单击以使用角度 ng-map 在谷歌地图中获取纬度和经度?

首先,我使用的是 Angular Google Map (ng-map)。我想获得谷歌地图纬度和经度的点击位置。

我的代码

0 投票
1 回答
185 浏览

javascript - AngularJS谷歌地图中标记的单独模板?

我想为 Angular Google Maps 中的标记点击事件维护一个单独的模板。在此模板上,我想在用户单击标记时显示标记信息。标记在test.html

相关问题

我的主要模板是

控制器是

0 投票
0 回答
279 浏览

javascript - 在 Angular-Google-map templateUrl for maker-window 中不起作用?

我想为制造商点击事件创建单独的模板。但是当我单击标记时,它会给出空模板。模板test.html未加载。为什么会这样。

请看运行演示

主要观点

标记模板

测试.html

控制器.js

0 投票
1 回答
128 浏览

javascript - 谷歌地图渲染——奇怪的圆圈覆盖了地图

我正在使用 angularjs-google-maps 指令,我的代码如下所示:

并且此地图无法正确渲染。上面有一些奇怪的圆圈,不知道为什么?

我的地图

知道为什么吗?

0 投票
1 回答
346 浏览

angularjs - AngularJS Google Map Directive - 在标记单击事件上显示 InfoWindow 时出错

我正在开发一个 AngularJs Google Map 应用程序(使用 AngularJS Google Map Directive)来使用 Marker 显示当前位置,并在单击 Marker 图标时在 InfoWindow 中显示坐标。

HTML:

控制器:

但是信息窗口仅在前两次单击标记图标时显示。Google Chrome 控制台窗口为每个标记单击显示此错误消息:

未捕获的类型错误:无法在 .Me

的 Object.maybeRepaint (angular-google-maps.min.js:7)
处设置未定义的属性“不透明度” 。(angular-google-maps.min.js:7)
在对象。
.z.trigger (js:95)
在 Ke._.k.trigger (js:113)
.JF。(maps.googleapis.com/maps-api-v3/api/js/26/10/infowindow.js:3)
在对象。
.z.trigger (js:95)
在 _.JF。(maps.googleapis.com/maps-api-v3/api/js/26/10/util.js:133)
.Zs。.k.Jh (maps.googleapis.com/maps-api-v3/api/js/26/10/common.js:204)

我不确定这是否是处理 Marker Click 事件的正确方法。请帮我解决这个问题。

0 投票
0 回答
234 浏览

angularjs - 使用 Controller 代替 $scope 进行 ng-map 标记指令

我正在使用angularjs 谷歌地图。我试图弄清楚如何this从控制器中利用 viewModel 实例 () 而不是使用$scope.

假设我有一个简单的控制器:

还有我的html:

这工作正常,我可以看到标记并单击它并在我的控制台中查看结果。如果我想将其转换为利用 viewModel( vm) 并改为:

我已经独立尝试了几件事,但在这里它们一次列出:

有些抛出错误,有些则什么也没做。对此有什么想法吗?或者ng-map,特别是marker指令,是否要求您使用$scope.