(اقرأ العنوان)
PS exportAs: 'agmMarker'
أنا جديد على Angular2 و AGM ، لكني أحب هذا ، أعتقد أنه كان سيصبح موجودًا بالفعل.
هل يعرف أي شخص كيفية الحصول على خط العرض / الغاز الطبيعي المسال من علامة جر ؟؟
@ سمث مات كسول مثل هذا:
<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>
لسبب ما عندما أحاول سحبها ، أحرك الخريطة بأكملها فقط ، ولا يمكنني تحريك العلامة ... هل من مساعدة في هذا؟
تم وضع علامة على هذه المشكلة تلقائيًا على أنها قديمة نظرًا لعدم وجود نشاط حديث لها. سيتم إغلاقه إذا لم يحدث أي نشاط آخر. شكرا لمساهماتكم.
التعليق الأكثر فائدة
@ سمث مات كسول مثل هذا:
<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(); }