-1

I am developing a web app that are based on google map. I am using angular js for it. I have to develop multiple marker on google map but I have to show only these markers which will be in 10 KM range but not in radius it should be from corners.
I using map.getBounds() for getting all corner's latitude and longitude I am new in angular js so please help me.

mishraoft
  • 113
  • 1
  • 4
  • 13
  • you can create a directive with google map API if ng-map haven't directive for this. What do you think? – Pterrat Apr 04 '16 at 09:52

1 Answers1

0

You can use ng-repeat, not sure if the code is correct, but the base idea is the next:

// html
<div ng-controller="mapCtrl as vm">
<ng-map zoom="15" center="vm.center">
    <marker ng-repeat="position in vm.positions"
            position="{{position.pos}}"
            title="pos: {{position.pos}}">
    </marker>
</ng-map>


// js
angular.module('app').controller('mapCtrl', function() {
    var vm = this;

    var markersCount = 10;
    var distanceBetweenMarkers = 0.01;

    vm.center = [40, -70];
    vm.positions = [];

    for(var i = 0; i < markersCount; i += 1) {
        var leftMarker = [vm.center[0] - distanceBetweenMarkers, vm.center[1]];
        var rightMarker = [vm.center[0] + distanceBetweenMarkers, vm.center[1]];

        vm.positions.push(leftMarker);
        vm.positions.push(rightMarker);
    }
});

I hope my answer will help you. : )
Thanks. : )