Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I'm new in AngularJS world

My question is about integration AngularJS and Google Maps API.

For example, in common JavaScript approach(as per Google Docs Specification) we just need to add init function like

function initMap() {
      var mapDiv = document.getElementById('map');
      var map = new google.maps.Map(mapDiv, {
          center: {lat: 44.540, lng: -78.546},
          zoom: 8
      });
}

And then pass our defined global function as a callback parameter to async script:

<script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
        async defer></script>

In AngularJS 2 we have components so my question is: Do we have ability to define initMap() function in component and then pass it like callback function?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.