Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 994 Bytes

README.md

File metadata and controls

43 lines (34 loc) · 994 Bytes

systemjs-plugin-googlemaps

SystemJS plugin to load Google Maps

jspm install systemjs-googlemaps=github:HeinrichFilter/systemjs-plugin-googlemaps

In config.js:

System.config({
  "paths": {
    // putting this in "map" breaks SystemJS builder
    "google-maps": "https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places"
  },
  "meta": {
    "google-maps": {
      "build": false, // exclude external Google Maps JS from SystemJS builder
      "loader": "systemjs-googlemaps"
    }
  }
});

In your app:

System.import('google-maps').then(function (GoogleMaps) {
    new GoogleMaps.Map(document.getElementById('map'), {
        center: {lat: -28.0, lng: 22.0},
        zoom: 6
    });
});

References

This code was adapted from various places: