Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing a google map in angular-ui modal?

Trying to load a simple google map within an angular-ui modal. However no luck. The data get's passed in fine, but nothing works in terms of the map... Please help.

$modalInstance.opened.then(function() {

var mapOptions = {
  center: new google.maps.LatLng(34.834442, -82.3686479),
  zoom: 8
};

  new google.maps.Map(document.getElementById("eventMap"), mapOptions);
});

Inside the modal html:

<div class="row clearfix">
  <div class="col-md-5" id="eventMap" style="display: block; height: 150px;"></div>
</div>

I tried this in the regular page HTML and worked fine...

What am I missing? Thank you in advance!

like image 615
user3124695 Avatar asked Jan 21 '26 10:01

user3124695


1 Answers

You can use angularjs-google-maps; an AngularJS directive for Google maps that is very flexible and powerful and easy to use. I've prepared a working demo for your case:

http://plnkr.co/edit/eEtaGH?p=preview

I hope this helps.

like image 130
Diana Nassar Avatar answered Jan 23 '26 22:01

Diana Nassar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!