I'm using the angular-google-maps directive. I'm using a ui-boostrap modal to display the map. I have my modal content defined in a file named mapSelectLocation.html. Here is how I open the modal:
var modalInstance = $modal.open({
templateUrl: '/path/to/templates/mapSelectLocation.html',
controller: 'mapSelectLocationController'
});
mapSelectLocation.html:
<div class='modal-body'>
<ui-gmap-google-map ng-if="readyForMap" center='map.center' zoom='map.zoom'> </ui-gmap-google-map>
</div>
mapSelectLocationController:
function mapSelectLocationController($scope, $modalInstance) {
$scope.map = { center: { latitude: 39.8433, longitude: -105.1190 }, zoom: 10 };
$scope.readyForMap = true;
}
This displays the popup and renders the map appropriately. However, when I close the modal and re-open it, the map does not render properly. Most of the map area is grayed out, with only a small portion of the map visible in the top-left corner.
However, if I move the content of mapSelectLocation.html from the file itself into an angular template script on the same page, it opens and reopens just fine, rendering correctly each time:
<script type="text/ng-template" id="mapSelectLocation.template">
<div class='modal-body'>
<ui-gmap-google-map ng-if="readyForMap" center='map.center' zoom='map.zoom'> </ui-gmap-google-map>
</div>
</script>
And of course update the templateUrl as well:
var modalInstance = $modal.open({
templateUrl: 'mapSelectLocation.template',
controller: 'mapSelectLocationController'
});
Can someone please tell me why it is not working to have my modal content in a separate file? I would rather keep it separate than have to use an angular script template.