GoogleMap AngularJS Directive ============================= [![Build Status](https://travis-ci.org/allenhwkim/angularjs-google-maps.png?branch=master)](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"`.
Directives ---------- #### <map .. > As defined on [MapOptions](https://developers.google.com/maps/documentation/javascript/reference#MapOptions), you can add any attributes, and events starting witn `on-`. Please note that event value must be a function. Example: i.e. < zoom="11" center="[40.74, -74.18]" #### <marker .. > As defined on [MarkerOptions](https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions), you can add any attributes, and events starting witn `on-`. #### <shape .. > Polyline, Circle, Polygon, Rectangle, and Images #### <info-window .. > Example:
#### <custom-control .. > Example:
Home1
#### <map-data .. > Example: ### Layer Directives #### <bicycling-layer .. > #### <weather-layer .. > (deprecated) and <cloud-layer .. > (deprecated) #### <fusion-tables-layer .. > #### <heatmap-layer .. > #### <maps-engine-layer .. > #### <traffic-layer> #### <transit-layer> #### <dynamic-maps-engine-layer .. > #### <kml-layer .. > ### MapType Directives #### <map-type .. > #### <overlay-map-type .. > Advanced Examples ------------------- - [Marker Clusterer](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/marker-clusterer.html) - [Starbucks World Wide](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/map_app.html) Contributors ============== [Fangmingdu] (https://github.com/Fangmingdu) - Drawing Manager license ======= [MIT License](https://github.com/allenhwkim/angularjs-google-maps/blob/master/LICENSE)