I have added google map in my angularjs application but I am unable to show marker on map. I have gone through a number of post on this topic (like: this and this) but it could not help. Below is my code snippet where lat and long are generated from random number:
HTML:
<ion-view view-title="Map">
<ion-content data-tap-disabled="true">
<div id="map">
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options">
<ui-gmap-markers models="markers" coords="'coords'" idKey="'idKey'"></ui-gmap-markers>
</ui-gmap-google-map>
</div>
</ion-content>
</ion-view>
Controller:
uiGmapGoogleMapApi.then(function(maps) {
lat = (Math.random()*(40-20)+20);
long = (Math.random()*(140-10)+10);
$scope.map = { center: { latitude: lat, longitude: long }, zoom: 8 };
});
uiGmapIsReady.promise(1).then(function(instances) {
instances.forEach(function(inst) {
var map = inst.map;
var uuid = map.uiGmap_id;
var myLatlng = new google.maps.LatLng(lat,long);
var mapOptions = {
zoom: 4,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'test!'
});
Can anyone please help to know what to change to make the marker seen on the google map. Below is the map shown which currently does not have marker: