Quick start
Obviously, because this module is an AngularJS module, you need first to load AngularJS.
-
Download the latest version on github or install it using bower:
bower install angular-google-maps-native
-
Load it into your HTML pages:
<script src="path/to/angular-google-maps-native.min.js"></script>
-
Add GoogleMapsNative into your module requirements:
angular.module('MyApp', ['GoogleMapsNative'])
-
The Google Maps API is asynchronously loaded as described on the official page.
If needed, you can configure it using its provider:.config(function(gmLibraryProvider) { gmLibraryProvider.configure({ language: 'fr' }); })
-
Google Maps require a width / height to display maps, prepare your CSS as well, e.g.
gm-map { display: block; width: 100%; height: 300px; }
-
Use the directives in your HTML pages, e.g.
<gm-map options="{center: [37.772323, -122.214897], zoom: 4, mapTypeId: google.maps.MapTypeId.ROADMAP}"> <gm-marker options="{position: [40.750, -73], draggable: true}"></gm-marker> </gm-map>