0
私はイオンフレームワークで新しいです。私はアプリを構築しています、コードワゴンのGoogleマッププラグインを使って作業しています。 私の問題はそれです:私は地図がロードされた後にすべてのカスタム情報ウィンドウが表示されるようにします。私は多くの選択肢を試しましたが、まだ運がありません。これで、マーカーをクリックするたびに1つのウィンドウしか開きません。別のマーカーをクリックすると閉じます。多分誰かが私にこの問題を解決するのを助けることができますか? ありがとう!ionic cordovaでいくつかのカスタム情報ウィンドウを開くプラグインgoogle map
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)
}