0
Angular 2+アプリでGoogleマップを活用するコンポーネントがあります。コンポーネントのメソッドをトリガーするマーカーの情報ウィンドウへのリンクを得るための適切な方法はありますか?以下の(click)
が問題点です。私がグローバルメソッドを作るのをやめたいならば(それを避けるために)onclick
にスワップすることができます。Google Maps InfoWindow - (クリック)Angular 2関数をトリガーする
//Add directions if we have a current location
let additionalContent = "";
if(this.positionMarker){
additionalContent = `<br><a href='#' (click)='startNavigating(${marker.position.lat()}, ${marker.position.lng()})'>Directions</a>`;
}
let infoWindow = new google.maps.InfoWindow({
content: content + additionalContent
});
google.maps.event.addListener(marker, 'click',() => {
infoWindow.open(this.map, marker);
});