I'm working with IONIC and AngularJS and have a Google Map included. I have a template and a Controller for this map and I will use the map on two Tabs.
.state('tab.map1', {
url: '/tab1/map',
views: {
'map1-tab': {
templateUrl: 'templates/map.html',
controller: 'MapController'
}
}
})
.state('tab.map2', {
url: '/tab2/map',
views: {
'map2-tab': {
templateUrl: 'templates/map.html',
controller: 'MapController'
}
}
})
HTML:
<div id="map"></div>
Controller:
$scope.map = new google.maps.Map(document.getElementById('map'), mapOptions);
URL on the first Tab: /tab1/map
URL on the second Tab: /tab2/map
Now when I call one of the URL's everything is fine and I can see my map. But when I change the tab I can't see the map anymore. the div seems to be empty. After page reload, the map is visible.
Does anybody knwo how to deal with the "same" page on multiple tabs? Thanks in advance.