GoogleMap AngularJS Directive ============================= [](https://travis-ci.org/allenhwkim/angularjs-google-maps) **NOTE: 1.4.0 is released.** * support lazy loading of maps js, which does not require to `http://maps.google.com/maps/api/js` **NOTE: 1.2.0 is released.** * events with `controller as` syntax, thanks to Simon **NOTE: 1.1.0 is released.** * marker directive can have icon attribute as JSON * map with init-event attribute for initialization by an event **NOTE: 1.0.0 is released.** Now, it covers all official google examples using new directives. The new directives are; * Layer Directives traffic-layer, transit-layer, weather-layer, bicycling-layer, cloud-layer, dynamic-maps-engine-layer, fusion-tables-layer, heatmap-layer, kml-layer, maps-engine-layer custom-control * info-window * map-data * map-type * overlay-map-type [Demo](http://ngmap.github.io) [Documentation](https://rawgithub.com/allenhwkim/angularjs-google-maps/master/build/docs/index.html) There is already [one](https://github.com/nlaplante/angular-google-maps) for this. However, I found myself doing totally different approach for this purpose than the existing one, such as; 1. **Everything in tag and attributes.** Thus, basic users don't even have to know what Javascript is. 2. **Expose all original Google Maps V3 api to the user.** No hiding, no wraping, or whatsoever. By doing so, programmers don't need to learn how to use this module. You only need to know Google Maps V3 API. There is a blog that introduces this module. The title of it is '[Google Map As The Simplest Way](http://allenhwkim.tumblr.com/post/70986888283/google-map-as-the-simplest-way)' To Get Started -------------- For Bower users, `$ bower install ngmap` 1. Include `ng-map.min.js` as well as google maps. `` `` 2. name angular app as ngMap, or add it as a dependency `var myApp = angular.module('myApp', ['ngMap']);` After map is initialized, you will have one event and map instances Event: * `mapInitialized` with parameter with map In case your map directive scope is different from your controller scope, use this event to get the map instance.
app.controller('parentParentController', function($scope) { $scope.$on('mapInitialized', function(event, map) { map.setCenter( .... ) .. }); });Instances: * `$scope.map` * `$scope.map.markers` * `$scope.map.shapes` * etc Lazy Loading ------------ Simply wrap the map tag with `map-lazy-load="http://maps.google.com/maps/api/js"`.