Skip to content

Instantly share code, notes, and snippets.

@AlexPetrov7311
Last active June 6, 2019 06:19
Show Gist options
  • Select an option

  • Save AlexPetrov7311/5a979a05fcb9f5dfaf9595dfc209b0df to your computer and use it in GitHub Desktop.

Select an option

Save AlexPetrov7311/5a979a05fcb9f5dfaf9595dfc209b0df to your computer and use it in GitHub Desktop.
searchControl.search('Казахстан, Алматы, ' + streetInput.value/*'4 Щербакова Алматы'*/
.then(function (res) {
var geoObjectsArray =searchControl.getResultsArray();
if (geoObjectsArray.length) {
// Выводит свойство name первого геообъекта из результатов запроса.
return geoObjectsArray
.map((item) => item.properties.getAll().metaDataProperty.GeocoderMetaData.Address.Components)
.filter(item => item.find(el => el.kind === 'street'))
.map(item =>{ return item.find(el => el.kind === 'street').name })
.map(name => {
return {
displayName: name,
value: name
}
})
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment