Failed to load google map api a second time.

I am learning AngularJS and Ionic, and I am adding the Google Maps API v3 to my application.

This is my controller:

$scope.drawMap = function(position) { $scope.$apply(function() { $scope.abc.lng = resp.data[0].longit; $scope.abc.lat = resp.data[0].latit; $scope.map = { center: { latitude: $scope.abc.lat, longitude: $scope.abc.lng }, zoom: 17 }; $scope.marker = { id: 0, coords: { latitude: $scope.abc.lat, longitude: $scope.abc.lng } }; $scope.marker.options = { draggable: false, labelAnchor: "80 120", //marker position labelClass: "marker-labels" }; }); } navigator.geolocation.watchPosition($scope.drawMap); $scope.$on('$ionicView.leave', function(){ map.remove(); }); 

}); })

This is my HTML:

 <ui-gmap-google-map center='map.center' zoom='map.zoom' events="map.markersEvents"> <ui-gmap-marker coords="marker.coords" options="marker.options" idkey="marker.id"> </ui-gmap-marker> </ui-gmap-google-map> 

Also directives:

 starter.directive('googleMap', function(){ return { templateUrl:"templates/google-map.html", link: function(scope, ele, attrs){ } } }) 

resp.data has a list of latlng addresses, and I can download the map when I get to this page.

But when I return to the last page and select a different address, it cannot load the map, which I can console.log latlng .

+7
angularjs google-maps google-maps-api-3 ionic
source share

No one has answered this question yet.

See related questions:

634
JS API Google v3 API - Simple Multiple Token Example
528
How to disable mouse wheel scaling using the Google Maps API
403
Google Maps API v3: How to remove all markers?
117
What options should be used in the URL of Google Maps to go to lat-lon?
2
Google Maps API - position / center by keyword (city name)
one
Removing a single marker with a calling card and google api cards
one
Js code to get marker location on google map not working
0
Focus Google Maps after adding a few points
0
Google map corner marker
-one
Google Map Change Center after placing markers

All Articles