A
A
AdNahim2017-02-28 12:54:03
JavaScript
AdNahim, 2017-02-28 12:54:03

How to catch the location event through the Yandex maps api?

I add a location button to the map ( controls: ['geolocaontrol' ...)
It is required to track when the user has determined his location in order to put a mark in the found place.
At the moment, it is clear how to get the location when initializing the map:

....
ymaps.geolocation.get({
  provider: 'yandex',
  autoReverseGeocode: true
}).then(function(result) {
  var text = result.geoObjects.get(0).properties.get('metaDataProperty').GeocoderMetaData.text;
  // Вывели точку
  console.log(text);
});
....

but how to perform this action only if the user clicked on "determine the location" ?
Thanks to.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2017-02-28
@freeExec

What's wrong with subscribing to the button 's "locate" onClick event?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question