【发布时间】:2015-12-08 01:51:05
【问题描述】:
我正在使用IonicFramework 和phonegap-googlemaps-plugin 开发一个应用程序,当用户单击 infoWindow 的标记时,它会调用确认函数,然后调用 launchNavigation 如果 true。
我的问题是,如果我使用原生 confirm 功能效果很好,但是当我尝试使用 $ionicPopup.confirm({}) 时,我无法点击确认纽扣。看来我一直在点击地图。
我已经尝试更改类“popup-containe”的 z-index 属性,但似乎没有按我预期的方式工作。
data.map(function (m) {
var latLng = new plugin.google.maps.LatLng(m.lat, m.lng)
latLngs.push(latLng);
map.addMarker({
position: latLng,
title: m.placa,
snippet: 'Clique para ir nessa localização.',
styles : {
'text-align': 'center',
'font-weight': 'bold'
}
}, function (marker) {
marker.addEventListener(plugin.google.maps.event.INFO_CLICK, function(marker) {
var confirm = $ionicPopup.confirm({
title: m.placa,
template: 'Abrir navegação para essa localização?',
okText: 'Sim',
cancelText: 'Não'
})
document.getElementsByClassName('popup-container')[0].style.zIndez = 999999;
confirm.then(function (response) {
if (response) {
map.getMyLocation(function (location) {
mobileLocation = location.latLng;
marker.getPosition(function(markerLocation) {
plugin.google.maps.external.launchNavigation({
'from': mobileLocation,
'to': markerLocation
});
})
})
}
})
$timeout(function() {
confirm.close();
}, 3000);
/*
if (confirm("Abrir direção para " + m.placa)) {
map.getMyLocation(function(location) {
mobileLocation = location.latLng;
marker.getPosition(function (markerLocation) {
plugin.google.maps.external.launchNavigation({
"from": mobileLocation,
"to": markerLocation
});
});
});
}
*/
});
});
});
谢谢
【问题讨论】:
-
试试
$scope.confirm而不是var confirm。 -
@mudasserajaz 没有用。这样,即使关闭超时也不能在这里工作。不知道为什么。
标签: javascript css cordova ionic-framework phonegap-plugins