While I try to wrap my head around Google Maps AngularJS directives, the ionic framework, angular directives in general and the possible ways of embedding a google map in an app, maybe someone could help me with this specific issue:
I want to set the center of an instantiated google map by providing a new latitude and longitude.
This doesn’t work:
$scope.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
It returns Uncaught TypeError: undefined is not a function
This does not work either:
$scope.map.control.refresh({latitude: pos.coords.latitude, longitude: pos.coords.longitude});
It returns: Uncaught TypeError: Cannot read property 'refresh' of undefined
I embedded the map using the method provided on Google Maps for AngularJS.
I know there’s this different approach on creating using a ‘map’ directive, but that confuses me a bit. What’s the difference between using this method and the Google Maps for AngularJS method?
By the way, using the Google Maps for Angular JS, I’m loading these two extra sources that are kind of heavy:
<script src='lib/lodash/dist/lodash.compat.js'></script>
<script src='lib/angular-google-maps/dist/angular-google-maps.js'></script>
Thanks a lot.