Friday, September 29, 2017

Way-points – How can i remove a specific way-point from google maps?

I am making this app with the help of google maps, i am successfully adding waypoints in a route and making a route between them. But on dbclick i remove that way point from the map. Now when i make the route it includes the deleted waypoint too. Because of the fact it does not delete from the waypoint array.

The question is how can i remove a specific waypoint from the waypoint array. I dont have any index of something.

pushing waypoints

/* Whenever a user taps a pin it goes into pinwapypts */
        pinwaypts.push({
          location: $scope.destination_route,
          stopover: true,

        });

Add waypoints in map

 infowindow.open($scope.map, marker);
        $scope.markers.push(marker);
        google.maps.event.addListener(marker, 'click', function () {
          infowindow.setContent($scope.results[0].formatted_address);
          infowindow.open($scope.map, this);
        });

removing waypoint marker from map

google.maps.event.addListener(marker, 'dblclick', function () {
          $scope.markers.pop().setMap(null);

        });

Now how can i remove a specific waypoint from its array ?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/29/way-points-how-can-i-remove-a-specific-way-point-from-google-maps/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment