HTML:
<ya-map ya-zoom="8" ya-center="[37.721587,55.30954]" ya-after-init="afterInit($target)"> <ya-cluster> <ya-geo-object ya-source="o" ng-repeat="o in res" ya-after-init="ifLast($target)"></ya-geo-object> </ya-cluster> </ya-map>
javascript:
var _map; $scope.ifLast = function(last){ if(!last){ return; } _map.geoObjects.each(function(obj){ _map.setBounds(obj.getBounds()); return false; }); }; $scope.afterInit = function(map){ _map=map; ymaps.geocode('Арбат').then( function(res){ var geos = []; res.geoObjects.each(function(obj){ //console.log(obj); geos.push({ geometry:{ type:obj.geometry.getType(), coordinates:obj.geometry.getCoordinates() }, properties:{ balloonContentBody:obj.properties.get('balloonContentBody') } }); }); $scope.$apply(function(){ $scope.res = geos; }); } ); } }