0
에서 여러 맞춤 정보 창이 열립니다. 이온 성 프레임 워크에서 새로운 것입니다. 나는 코드바 Google지도 플러그인으로 작업하는 앱을 만들고 있습니다. 내 문제는 : 나는 모든 사용자 정의 정보 창이지도가로드 된 후 표시됩니다. 나는 많은 옵션을 시도했지만 여전히 운이 없다. 이제는 마커를 클릭 할 때마다 하나의 창만 열고 다른 마커를 클릭하면 창을 닫습니다. 어쩌면 누군가가 내가이 문제를 해결하도록 도울 수 있을까? 감사합니다.ionic cordova 플러그인 google지도
addMarkers(markers){
for(let marker of markers){
this.map.addCircle({
center:{lat:marker.lat, lng:marker.lng},
radius: 50,
strokeColor: 'red',
strokeWidth:1,
fillColor:'red'
});
this.map.addMarker({
icon: {
'url': "./assets/marker.png",
'size': {
width: 27,
height: 10
},
},
animation: 'DROP',
position: {
lat: marker.lat,
lng: marker.lng
}
}).then((marker)=>{
marker.on(GoogleMapsEvent.MARKER_CLICK)
.subscribe(() => {
this.bindInfo(marker, this.setDiv(div));
})
})
}
}
setDiv(div){
let compFactory = this.resolver.resolveComponentFactory(DivComponent);
this.compRef = compFactory.create(this.injector);
if (this.compRef) this.compRef.instance.timeInSeconds = div.time;
this.appRef.attachView(this.compRef.hostView);
let div = document.createElement('div');
div.appendChild(this.compRef.location.nativeElement);
return div
}
bindInfo(marker, content){
let info= new HtmlInfoWindow();
info.setContent(content);
info.open(marker)
}