getting an error when using google maps multiple times with the following code
var checkForMap = function() {
$scope.post.showMap = true;
var myLatlng = new google.maps.LatLng($scope.post.location.x, $scope.post.location.y);
var myOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var mapHolder = $('.map_class')[$scope.$index];
$scope.map = new google.maps.Map(mapHolder, myOptions);
var infowindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
map: $scope.map,
position: myLatlng
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent($scope.item.post.post.locationName);
infowindow.open(map, this);
});
}
if ($scope.post.locationName != null) {
checkForMap();
} else {
$scope.post.showMap = false;
}
using google maps multiple times.By using $scope.$index i can display exact location.