点击infowindow
点击我要导航到其他页面..
.controller('MapCtrl', function ($scope, $state, $cordovaGeolocation, $compile) {
var myLatlng = new google.maps.LatLng(21.117181, 79.070339);
var mapOptions = {
center: myLatlng,
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
var contentString = "<button ng-click='gotoBooking()'>Book</button>";
var compiled = $compile(contentString)($scope);
var infowindow = new google.maps.InfoWindow({
content: compiled[0]
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
});
marker.addListener('click', function () {
infowindow.close();
infowindow.open(map, marker);
});
var myLatlng2 = new google.maps.LatLng(21.16581, 79.070339);
var marker2 = new google.maps.Marker({
position: myLatlng2,
map: map,
});
marker2.addListener('click', function () {
infowindow.close();
infowindow.open(map, marker2);
});
$scope.map = map;
$scope.gotoBooking = function () {
$state.go('app.makeBooking');
};
});