I am trying to create a link inside an InfoWindow on a Google Map, using the angular-google-maps module's ui-gmap-windows
.
In my HTML template, I have:
<ui-gmap-google-map center='main.map.center' zoom='main.map.zoom' options='main.map.options'>
<ui-gmap-markers models="main.markers" coords="'self'" icon="'icon'" options="'options'" click="'onClick'" fit="true">
<ui-gmap-windows show="'showWindow'" closeClick="'closeClick'" ng-cloak>
<div class="mapinfowindow" data-ui-sref="display({id: id})">
<span class="itemname" data-ng-non-bindable>{{ title }}</span>
</div>
</ui-gmap-windows>
</ui-gmap-markers>
</ui-gmap-google-map>
In my controller, I have:
uiGmapGoogleMapApi.then(function(maps) {
vm.itemlist = search.getItemList();
var markers = [];
_.each(vm.itemlist,function(item){
search.getGeometry(item.href).then(function(marker) {
marker.title = item.en;
marker.id = item.href;
marker.showWindow = false;
marker.options = {
title: item.en,
icon: markericon.normal
};
marker.onClick = function() { vm.markerClick(marker); };
marker.closeClick = function() { vm.markerCloseClick(marker); };
markers.push(marker);
});
});
vm.markers = markers;
});
Note that I'm using the 'controller as' syntax, so the vm.markers
in the controller appears as main.markers
in the html template.
The problem I'm seeing is that the data-ui-sref="display({id: id})"
in the html changes the state to the 'display' page, but does not push through the id
as a $stateParams value, which is obviously not good, as I won't know what to display..
I have another link to the same page, created outside the InfoWindow (in a list of results), and the does push through the id value:
<div data-ng-repeat="entry in main.itemlist">
<div data-ui-sref="display({id: entry.id})">
Any help with getting the InfoWindow's link working will be very much appreciated.