I am trying to load maps for each list item in a new page.
But it is working (sometimes on web browsers but not at all in Android emulator).
Please help me on this
........... <script type="text/ng-template" Incident Map <div id="map" ng-controller="MapCtrl">
</div>
</ion-content>
</ion-view>
</script>
app.js:
.controller(‘MapCtrl’,function($scope,sharedProp){
google.maps.event.addDomListener(window, ‘load’, function() {
var myLatlng = new google.maps.LatLng(37.3000, -120.4833);
var mapOptions = {
center: myLatlng,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
navigator.geolocation.getCurrentPosition(function(pos) {
map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
var myLocation = new google.maps.Marker({
position: new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude),
map: map,
title: "My Location"
});
});
$scope.map = map;
});