【发布时间】:2017-06-06 13:41:39
【问题描述】:
我正在使用 ngMap,但信息窗口未与标记对齐。它们通常看起来在标记的上方和左侧约 50 像素处。我应该注意到它最初确实有效,然后我们从 Mongo 更改为 SQL,并且由于某种原因,之后它再也没有对齐....
截图
模板
<!-- the map -->
<ng-map
id="map"
scrollwheel="false"
class="row"
>
<marker
id="{{p.scheduleId}}"
ng-repeat="p in locatorGridData track by p.scheduleId"
position="{{p.latitude}}, {{p.longitude}}"
icon="{
url:'app/assets/img/placeholder.png',
scaledSize:[30,30]
}"
on-click="vm.selectFromMap(p)"
class="markers"
></marker>
<info-window id="infoWindow" visible-on-marker="vm.p.scheduleId">
<div ng-non-bindable="" ng-click="vm.selectFromMap({},vm.p)" style="cursor: pointer;">
<div class="practice-name">{{vm.p.locName}}</div>
<div class="name-specialty">{{vm.p.firstName}} {{vm.p.lastName}}, {{vm.p.speciality}}</div>
<div class="other-text-for-info-window">
{{vm.p.address1}}<br>
{{vm.p.city}}, {{vm.p.state}}<br>
{{vm.p.zip}}
</div>
</div>
</info-window>
</ng-map>
控制器
NgMap.getMap({id:'map'}).then(function(map) {
vm.map = map;
//GEOCODER
patientPos(vm.patientLat, vm.patientLon);
});
function patientPos(patientLat, patientLon) {
console.log(patientLat,patientLon, 'patient coordinate')
var bounds2 = new google.maps.LatLngBounds();
var latLng2 = new google.maps.LatLng($sessionStorage.patient_location.patientLat, $sessionStorage.patient_location.patientLon);
bounds2.extend(latLng2);
vm.map.fitBounds(bounds2);
vm.map.setZoom(12);
}
vm.showDetail = showDetail;
vm.hideDetail = hideDetail;
vm.selectFromMap = selectFromMap;
//info window stuff
function showDetail (e, p) {
vm.p = p;
console.log('showdetail', e, p)
vm.map.showInfoWindow('infoWindow', p.scheduleId);
};
function selectFromMap(e,p){
vm.p = p;
vm.map.showInfoWindow('infoWindow', p.scheduleId);
var getAllRows = $scope.grid1Api.core.getVisibleRows($scope.grid1Api.grid);
// c.log(getAllRows);
// console.log(schedules);
console.log(p)
vm.schedules.forEach(function(schedule,idx){
if(schedule.scheduleId == p.scheduleId){
$scope.grid1Api.selection.selectRow(vm.schedules[idx]);
console.log(schedules[idx]);
console.log(idx);
$scope.grid1Api.grid.getColumn('locName').filters[0] = {
term: vm.schedules[idx].locName
};
}
})
}
function hideDetail (e, p) {
if(vm.map){
vm.map.hideInfoWindow('infoWindow');
}
}
【问题讨论】:
标签: angularjs google-maps google-maps-api-3 ng-map