Answer the question
In order to leave comments, you need to log in
Don't understand how variables work in Angular?
$scope.geoObjects = [
{ Name: "Москва, Слесарный переулок, д.3"},
{ Name: "Люберцы, Октябрьский проспект д.143"},
{ Name: "Москва, 3-я Хорошевская улица д.2, стр.1"},
{ Name: "Москва, Нижний Сусальный переулок, д.5, стр.4"},
];
var geocodeQuery;
for (var i = 0, ii = $scope.geoObjects.length; i < ii; i++) {
geocodeQuery = $scope.geoObjects[i].Name;
ymaps.geocode(geocodeQuery).then(function (res) {
res.geoObjects.each(function(geoObject){
$scope.$apply(function(){
$scope.geoObjects[i]=
{
geometry:{
type:'Point',
coordinates:geoObject.geometry.getCoordinates(),
properties:{
// А в качестве контента балуна - подробности:
// имена всех остальных найденных объектов.
balloonContent:geoObject.properties.get('name')
}
}
};
});
});
});
}
Answer the question
In order to leave comments, you need to log in
You do not understand variables in Angular, but scopes and asynchrony in js.
https://learn.javascript.ru/task/make-army
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question