I used ng-map (http://ngmap.github.io/) in a modal to serve googlemap in my application, but after an exception in that directive my close button in the footer wont work. When I put that close button before the directive(for example in header) it works! How should I catch such exceptions and keep the control?
my modal is as bellow:
<script type="text/ng-template" id="views/OfficeMapModal.html">
<div class="modal-header">
<div class="modal-title">{{address}}</div>
</div>
<div class="modal-body">
<ng-map zoom="15" center="{{center.latitude}}, {{center.longitude}}">
<marker position="{{center.latitude}}, {{center.longitude}}"></marker>
</ng-map>
</div>
<div class="modal-footer">
<div class="btn btn-default select-again" data-ng-click="cancel()">close</div>
</div>
</script>
and my modal controller is as bellow:
angular.module('portalApp').controller('GoogleMapModalController', ['$scope', 'NgMap', '$uibModalInstance', 'address', 'center', function ($scope, NgMap, $uibModalInstance, address, center) {
$scope.address = address;
$scope.center = center;
NgMap.getMap().then(function (map) {
google.maps.event.trigger(map, 'resize');
var myLatLng = new google.maps.LatLng(center.latitude, center.longitude);
map.setCenter(myLatLng);
});
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};}]);
Edit:
Error: google is not defined t@http://localhost:3000/bower_components/ngmap/build/scripts/ng-map.min.js:1:2423