NG-地图上点击无法在移动工作 [英] ng-map on-click doesn't work on mobile

查看:110
本文介绍了NG-地图上点击无法在移动工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个混合的应用程序,需要一个谷歌地图,因为我有角工作很容易,我使用的 NG-地图

I'm building an hybrid app that requires a google map and since I'm working with angular it's easier for me to use ng-map.

我有一些问题,标记上单击事件

I'm having some problems with the on-click event of the marker

<marker position="{{m.center}}" ng-repeat="m in markers" on-click="selectRequest(m)" icon="images/marker-{{m.status}}.png"></marker>

它正常工作用鼠标桌面,但没有对手机触摸事件。

It works fine on desktop with the mouse but not with touch events on mobile phone.

为什么?

推荐答案

感谢 SSH 上述评论我做到了这一点:

Thanks to SSH comments above I accomplished this:

$scope.requests.forEach(function(elem) {
                var marker = new google.maps.Marker({
                    map: map,
                    position: new google.maps.LatLng(elem.latitude, elem.longitude),
                    icon: "images/marker-"+elem.status+".png",
                });

                google.maps.event.addListener(marker, "mousedown", function() {
                    $scope.selectedRequest = elem;
                    $scope.$apply();
                });
            });

这篇关于NG-地图上点击无法在移动工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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