0
Tüm ülke adını ve durum adını addressComponents üzerinde başlatıp güncelleyemiyorum. Ben kısa isimleri alıyorum rağmen ben devlet ve ülke long_name ayrıştırmak ve geri almak istiyorum.Ayrıştırma adresiBilgisayarınızda Bileşenleri
JS
function updateControls(addressComponents) {
$('#ustate').val(addressComponents.stateOrProvince);
$('#ucountry').val(addressComponents.country);
}
$('#mapz').locationpicker({
location: {
latitude: 45.91886765642549,
longitude: -77.57585875078735
},
radius: 300,
inputBinding: {
locationNameInput: $('#pac-input'),
},
enableAutocomplete: true,
onchanged: function(currentLocation, radius, isMarkerDropped) {
var addressComponents = $(this).locationpicker('map').location.addressComponents;
updateControls(addressComponents);
},
oninitialized: function(component) {
var addressComponents = $(component).locationpicker('map').location.addressComponents;
updateControls(addressComponents);
}
});
HTML: Aşağıdaki kodundan ülkeyi alabilirsiniz
<div style="width: 900px !important; height:300px !important" id="mapz"></div>
<input autocomplete="off" placeholder="Search Box" id="pac-input" class="text_field" type="text">
<input type="text" name="ucountry" id="ucountry" size="45" value="" class="text_field" />
<input type="text" name="ustate" id="ustate" maxlength="75" class="text_field" />
Kardeş yok, console.log yerine uyarıldı ve aynı zamanda global değişkende uzun isim depolamaya çalıştı ve hala hiçbir şey alınamadı. Mümkünse kodumu düzenleyebilir miyim –
Bir keman oluştur ve ben – ihimv
göreceksiniz bir fiddle oluşturdum ama harita görüntüleyemiyorum. https://jsfiddle.net/kishorejv/md1L2285/1/#&togetherjs=Kcx0lHtCv7 –