(์ ๋ชฉ ์ฝ๊ธฐ)
์ถ์ exportAs: 'agmMarker'
์ ๋ Angular2์ AGM์ ์ฒ์ ์ฌ์ฉํ์ง๋ง ์ด ๊ธฐ๋ฅ์ ์ ๋ง ์ข์ํ ๊ฒ์
๋๋ค. ์ด๋ฏธ ํฌํจ๋์ด ์์ ๊ฑฐ๋ผ๊ณ ์๊ฐํ์ต๋๋ค.
๋๋๊ทธ ํ ๋ง์ปค์์ ์๋/๊ฒฝ๋๋ฅผ ์ป๋ ๋ฐฉ๋ฒ์ ์๋ ์ฌ๋์ด ์์ต๋๊น?
@matt-lethargic Smth๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<agm-marker [markerDraggable]="true"
(dragEnd)="markerMoved($event)"
[latitude]="latitude || 39.8282"
[longitude]="longitude || -98.5795"></agm-marker>
markerMoved(e) {
const geocoder = new google.maps.Geocoder();
geocoder.geocode({'location': e.coords}, (res, status) => {
if (status === google.maps.GeocoderStatus.OK && res.length) {
this.ngZone.run(() => this.setLocation(res[0]));
}
})
}
setLocation(place) {
this.latitude = place.geometry.location.lat();
this.longitude = place.geometry.location.lng();
}
<agm-marker (dragEnd)="draggEnded($event)" [markerDraggable]="true" [latitude]="tripMirror.departure?.latitude"
[longitude]="tripMirror.departure?.longitude" iconUrl="assets/icons/icon_marker_red.png"></agm-marker>
์ด๋ค ์ด์ ์์์ธ์ง ๋๋๊ทธํ๋ ค๊ณ ํ๋ฉด ์ ์ฒด ๋งต๋ง ์ด๋ํ๊ณ ๋ง์ปค๋ฅผ ์ด๋ํ ์ ์์ต๋๋ค... ๋์์ด ํ์ํ์ญ๋๊น?
์ด ๋ฌธ์ ๋ ์ต๊ทผ ํ๋์ด ์์๊ธฐ ๋๋ฌธ์ ์๋์ผ๋ก ์ค๋๋ ๊ฒ์ผ๋ก ํ์๋์์ต๋๋ค. ๋ ์ด์ ํ๋์ด ์์ผ๋ฉด ํ์๋ฉ๋๋ค. ๊ทํ์ ๊ธฐ์ฌ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@matt-lethargic Smth๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<agm-marker [markerDraggable]="true" (dragEnd)="markerMoved($event)" [latitude]="latitude || 39.8282" [longitude]="longitude || -98.5795"></agm-marker>
markerMoved(e) { const geocoder = new google.maps.Geocoder(); geocoder.geocode({'location': e.coords}, (res, status) => { if (status === google.maps.GeocoderStatus.OK && res.length) { this.ngZone.run(() => this.setLocation(res[0])); } }) }
setLocation(place) { this.latitude = place.geometry.location.lat(); this.longitude = place.geometry.location.lng(); }