Skip to content

Commit 0ec6dca

Browse files
committed
2 parents 36fdc2d + 3055247 commit 0ec6dca

24 files changed

+1009
-384
lines changed

CONTRIBUTORS.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
#Angularjs-Google-Maps Is Only Possible By;
22

3-
<a href='https://github.com/allenhwkim' title='allenhwkim'><img src='https://avatars.githubusercontent.com/u/1437734?v=3' width='60px' /></a>
4-
<a href='https://github.com/HamzaAzeem' title='HamzaAzeem'><img src='https://avatars.githubusercontent.com/u/5498973?v=3' width='60px' /></a>
5-
<a href='https://github.com/Fangmingdu' title='Fangmingdu'><img src='https://avatars.githubusercontent.com/u/5725594?v=3' width='60px' /></a>
6-
<a href='https://github.com/dlukez' title='dlukez'><img src='https://avatars.githubusercontent.com/u/1725353?v=3' width='60px' /></a>
7-
<a href='https://github.com/Jonfor' title='Jonfor'><img src='https://avatars.githubusercontent.com/u/3246528?v=3' width='60px' /></a>
8-
<a href='https://github.com/harm-less' title='harm-less'><img src='https://avatars.githubusercontent.com/u/6368074?v=3' width='60px' /></a>
9-
<a href='https://github.com/AlexandreKilian' title='AlexandreKilian'><img src='https://avatars.githubusercontent.com/u/2519487?v=3' width='60px' /></a>
10-
<a href='https://github.com/hokennethk' title='hokennethk'><img src='https://avatars.githubusercontent.com/u/9583804?v=3' width='60px' /></a>
11-
<a href='https://github.com/prem-prakash' title='prem-prakash'><img src='https://avatars.githubusercontent.com/u/775409?v=3' width='60px' /></a>
12-
<a href='https://github.com/stevenlundy' title='stevenlundy'><img src='https://avatars.githubusercontent.com/u/4694092?v=3' width='60px' /></a>
13-
<a href='https://github.com/jpagand' title='jpagand'><img src='https://avatars.githubusercontent.com/u/2401332?v=3' width='60px' /></a>
14-
<a href='https://github.com/jkornata' title='jkornata'><img src='https://avatars.githubusercontent.com/u/7041200?v=3' width='60px' /></a>
15-
<a href='https://github.com/sposmen' title='sposmen'><img src='https://avatars.githubusercontent.com/u/1591405?v=3' width='60px' /></a>
16-
<a href='https://github.com/aitboudad' title='aitboudad'><img src='https://avatars.githubusercontent.com/u/1753742?v=3' width='60px' /></a>
17-
<a href='https://github.com/joakimkm' title='joakimkm'><img src='https://avatars.githubusercontent.com/u/6367074?v=3' width='60px' /></a>
18-
<a href='https://github.com/mliu95' title='mliu95'><img src='https://avatars.githubusercontent.com/u/4820950?v=3' width='60px' /></a>
19-
<a href='https://github.com/pmcochrane' title='pmcochrane'><img src='https://avatars.githubusercontent.com/u/7922620?v=3' width='60px' /></a>
20-
<a href='https://github.com/pennysmith1' title='pennysmith1'><img src='https://avatars.githubusercontent.com/u/13732116?v=3' width='60px' /></a>
21-
<a href='https://github.com/sebrojas14' title='sebrojas14'><img src='https://avatars.githubusercontent.com/u/1771574?v=3' width='60px' /></a>
22-
<a href='https://github.com/simonh1000' title='simonh1000'><img src='https://avatars.githubusercontent.com/u/5256724?v=3' width='60px' /></a>
23-
<a href='https://github.com/csdigi' title='csdigi'><img src='https://avatars.githubusercontent.com/u/43999?v=3' width='60px' /></a>
24-
<a href='https://github.com/xavierjohn' title='xavierjohn'><img src='https://avatars.githubusercontent.com/u/1859710?v=3' width='60px' /></a>
25-
<a href='https://github.com/kpgarrod' title='kpgarrod'><img src='https://avatars.githubusercontent.com/u/2155409?v=3' width='60px' /></a>
26-
<a href='https://github.com/martinmicunda' title='martinmicunda'><img src='https://avatars.githubusercontent.com/u/1643606?v=3' width='60px' /></a>
3+
<a href='https://github.com/allenhwkim' title='allenhwkim'><img src='https://avatars2.githubusercontent.com/u/1437734?v=3' width='60px' /></a>
4+
<a href='https://github.com/HamzaAzeem' title='HamzaAzeem'><img src='https://avatars1.githubusercontent.com/u/5498973?v=3' width='60px' /></a>
5+
<a href='https://github.com/Pixelmixer' title='Pixelmixer'><img src='https://avatars2.githubusercontent.com/u/347311?v=3' width='60px' /></a>
6+
<a href='https://github.com/aitboudad' title='aitboudad'><img src='https://avatars1.githubusercontent.com/u/1753742?v=3' width='60px' /></a>
7+
<a href='https://github.com/trainerbill' title='trainerbill'><img src='https://avatars2.githubusercontent.com/u/3578259?v=3' width='60px' /></a>
8+
<a href='https://github.com/Fangmingdu' title='Fangmingdu'><img src='https://avatars2.githubusercontent.com/u/5725594?v=3' width='60px' /></a>
9+
<a href='https://github.com/jo3d3v' title='jo3d3v'><img src='https://avatars3.githubusercontent.com/u/16099282?v=3' width='60px' /></a>
10+
<a href='https://github.com/dlukez' title='dlukez'><img src='https://avatars1.githubusercontent.com/u/1725353?v=3' width='60px' /></a>
11+
<a href='https://github.com/Jonfor' title='Jonfor'><img src='https://avatars2.githubusercontent.com/u/3246528?v=3' width='60px' /></a>
12+
<a href='https://github.com/AlexandreKilian' title='AlexandreKilian'><img src='https://avatars3.githubusercontent.com/u/2519487?v=3' width='60px' /></a>
13+
<a href='https://github.com/calraiden' title='calraiden'><img src='https://avatars1.githubusercontent.com/u/1984844?v=3' width='60px' /></a>
14+
<a href='https://github.com/galenmarchetti' title='galenmarchetti'><img src='https://avatars2.githubusercontent.com/u/11703004?v=3' width='60px' /></a>
15+
<a href='https://github.com/harm-less' title='harm-less'><img src='https://avatars3.githubusercontent.com/u/6368074?v=3' width='60px' /></a>
16+
<a href='https://github.com/hokennethk' title='hokennethk'><img src='https://avatars1.githubusercontent.com/u/9583804?v=3' width='60px' /></a>
17+
<a href='https://github.com/NicolasBonduel' title='NicolasBonduel'><img src='https://avatars2.githubusercontent.com/u/6507454?v=3' width='60px' /></a>
18+
<a href='https://github.com/razvan-tudosa' title='razvan-tudosa'><img src='https://avatars3.githubusercontent.com/u/4538108?v=3' width='60px' /></a>
19+
<a href='https://github.com/stevenlundy' title='stevenlundy'><img src='https://avatars0.githubusercontent.com/u/4694092?v=3' width='60px' /></a>
20+
<a href='https://github.com/Tallyb' title='Tallyb'><img src='https://avatars1.githubusercontent.com/u/7386255?v=3' width='60px' /></a>
21+
<a href='https://github.com/TimoPerplex' title='TimoPerplex'><img src='https://avatars3.githubusercontent.com/u/8859672?v=3' width='60px' /></a>
22+
<a href='https://github.com/TonyWilk' title='TonyWilk'><img src='https://avatars1.githubusercontent.com/u/6328677?v=3' width='60px' /></a>
23+
<a href='https://github.com/stillgbx' title='stillgbx'><img src='https://avatars0.githubusercontent.com/u/15780237?v=3' width='60px' /></a>
24+
<a href='https://github.com/jpagand' title='jpagand'><img src='https://avatars2.githubusercontent.com/u/2401332?v=3' width='60px' /></a>
25+
<a href='https://github.com/nkovacic' title='nkovacic'><img src='https://avatars2.githubusercontent.com/u/3670753?v=3' width='60px' /></a>
26+
<a href='https://github.com/jkornata' title='jkornata'><img src='https://avatars0.githubusercontent.com/u/7041200?v=3' width='60px' /></a>
27+
<a href='https://github.com/sebas-nicholls' title='sebas-nicholls'><img src='https://avatars0.githubusercontent.com/u/12138918?v=3' width='60px' /></a>
28+
<a href='https://github.com/andrew-smith3' title='andrew-smith3'><img src='https://avatars0.githubusercontent.com/u/5403519?v=3' width='60px' /></a>
29+
<a href='https://github.com/danaronoff' title='danaronoff'><img src='https://avatars0.githubusercontent.com/u/8923132?v=3' width='60px' /></a>
30+
<a href='https://github.com/dan-santana' title='dan-santana'><img src='https://avatars2.githubusercontent.com/u/6091633?v=3' width='60px' /></a>
31+
<a href='https://github.com/hefler' title='hefler'><img src='https://avatars3.githubusercontent.com/u/195560?v=3' width='60px' /></a>
32+
<a href='https://github.com/francisrath' title='francisrath'><img src='https://avatars2.githubusercontent.com/u/197670?v=3' width='60px' /></a>
2733
## We Love You All

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GoogleMap AngularJS Directive
1+
Google Maps AngularJS Directive
22
=============================
33
<!--
44
[![Build Status](https://travis-ci.org/allenhwkim/angularjs-google-maps.png?branch=master)](https://travis-ci.org/allenhwkim/angularjs-google-maps)
@@ -10,37 +10,37 @@ GoogleMap AngularJS Directive
1010
[Maps Can Talk](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker.html) |
1111
[Custom Marker](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker-2.html)
1212

13-
If you like this, you also may like these;
14-
* [ng2-map](https://github.com/ng2-ui/ng2-maps) Google Maps Wrapper for Angular 2+
13+
If you like this, you also may like these:
14+
* [ng2-map](https://github.com/ng2-ui/map) Google Maps Wrapper for Angular 2+
1515
* [react-openlayers](https://github.com/allenhwkim/react-openlayers) React + OpenLayers
1616

1717
Background
1818
-----------------
19-
There is already [one](https://github.com/nlaplante/angular-google-maps) for this. However, I found myself doing totally different approach than the existing one, such as;
19+
There is already [one](https://github.com/nlaplante/angular-google-maps) for this. However, I found myself taking a totally different approach than the existing one, such as:
2020

2121
1. **Everything in tag and attributes.**
22-
Thus, basic users don't even have to know what Javascript is.
23-
24-
2. **Expose all original Google Maps V3 api to the user.**
25-
No hiding, no wraping, or whatsoever.
22+
Thus, users don't even need knowledge of JavaScript.
23+
24+
2. **Expose all original Google Maps V3 API to the user.**
25+
No hiding, no wrapping or whatsoever.
2626
By doing so, programmers don't need to learn how to use this module.
2727
You only need to know Google Maps V3 API.
2828

2929
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)'
3030

31-
To Get Started
31+
To get started
3232
--------------
33-
For Bower users,
33+
For Bower users,
3434

3535
`$ bower install ngmap`
3636

3737
1. Include `ng-map.min.js`:
3838
`<script src="/bower_components/ngmap/build/scripts/ng-map.min.js"></script>`
3939

40-
2. Include Google maps:
40+
2. Include Google Maps:
4141
`<script src="http://maps.google.com/maps/api/js"></script>`
4242

43-
2. Name your angular app ngMap, or add it as a dependency
43+
2. Name your AngularJS app ngMap, or add it as a dependency
4444

4545
`var myApp = angular.module('myApp', ['ngMap']);`
4646

@@ -54,13 +54,13 @@ To get the map instance use the `NgMap.getMap()` function
5454
});
5555
});
5656

57-
For npm users,
57+
For npm users,
5858

5959
`$ npm install ngmap`
6060

61-
For meteor users: https://atmospherejs.com/wormy/angularjs-google-maps
61+
For Meteor users: https://atmospherejs.com/wormy/angularjs-google-maps
6262

63-
Lazy Loading of Google Maps Javascript
63+
Lazy loading of Google Maps JavaScript
6464
---------------------------------------
6565
Simply wrap the map tag with `map-lazy-load="https://maps.google.com/maps/api/js"`.
6666

@@ -76,12 +76,12 @@ Lazy Loading of Google Maps Javascript
7676
map-lazy-load-params="{{googleMapsUrl}}">
7777
<ng-map center="41,-87" zoom="3"></ng-map>
7878
</div>
79-
79+
8080
FAQ
8181
----
82-
## Grey area in Google maps
82+
## Grey area in Google Maps
8383

84-
The usual reason why this is happening is that the size of the map is changed after the map has been initialized. If you for some reason change the size of the div, you need to trigger the "resize" event and possible reCenter the map.
84+
The usual reason why this happens is that the size of the map is changed after the map has been initialized. If you for some reason change the size of the div, you need to trigger the "resize" event and possible recenter the map.
8585

8686
var center = map.getCenter();
8787
google.maps.event.trigger(map, "resize");
@@ -91,9 +91,9 @@ Ref.
9191
* http://stackoverflow.com/questions/13901520/grey-area-in-google-maps
9292
* http://blog.codebusters.pl/en/google-maps-in-hidden-div/
9393

94-
## Check if a marker is within Map, Rectangle, or Circle
94+
## Check if a marker is within `Map`, `Rectangle`, or `Circle`
9595

96-
map.getBounds().contains(marker.getPosition()
96+
`map.getBounds().contains(marker.getPosition());`
9797

9898
* http://stackoverflow.com/questions/3648545/how-can-i-check-the-marker-is-or-isnt-in-the-bounds-using-google-maps-v3
9999
* https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map
@@ -102,18 +102,18 @@ Ref.
102102

103103
## Calculate distance between two position
104104

105-
You may checkout this, https://developers.google.com/maps/documentation/javascript/distancematrix.
105+
You can check this out: https://developers.google.com/maps/documentation/javascript/distancematrix.
106106
As you see, DistanceMatrix does not require map nor directive.
107107

108-
Another way to do is to use directions directive. As you see it here, https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/directions2.html, you have access to DirectionsRenderer by using `map.directionsRenderers[id]`
108+
Another way to do this, is to use directions directive. As you see it here: https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/directions2.html, you have access to DirectionsRenderer by using `map.directionsRenderers[id]`
109109

110110
https://developers.google.com/maps/documentation/javascript/reference?hl=en#DirectionsRenderer
111111

112-
You use getDirections() or directions, then calculate the distance from there. e.g.,
112+
You use `getDirections()` or `directions`, then calculate the distance from there. e.g.,
113113

114114
Distance:
115-
{{map.directionsRenderers[0].directions.routes[0].legs[0].distance}}
116-
115+
`{{ map.directionsRenderers[0].directions.routes[0].legs[0].distance }}`
116+
117117
Directives
118118
----------
119119

@@ -141,7 +141,7 @@ Directives
141141
* traffic-layer
142142
* transit-layer
143143

144-
Advanced Examples
144+
Advanced examples
145145
-------------------
146146
- [Marker Clusterer](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/marker-clusterer.html)
147147
- [Starbucks World Wide](https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/map_app.html)
@@ -154,16 +154,16 @@ Advanced Examples
154154

155155
Contributing
156156
============
157-
- Clone the repository from github
158-
- Change to the folder dowloaded
157+
- Clone the repository from GitHub.
158+
- Change to the cloned directory.
159159
- **npm install** to install the build tools
160-
- **gulp build** to build the javascript & doc files in the /build folder & run the unit tests.
161-
- **gulp clean** to cleanup the repository by removing files and folders from previous build.
160+
- **gulp build** to build the JavaScript & doc files in the /build folder & run the unit tests.
161+
- **gulp clean** to clean up the repository by removing files and folders from previous build.
162162
- **gulp test** to run the Karma unit test suite.
163163
- **gulp test:e2e** to run the Protractor test suite. For the first test run, you may need to update the protractor webdriver manager. It will show the command on screen if this is required (node_modules/gulp-protractor/node_modules/protractor/bin/webdriver-manager update).
164164
- **gulp test:server** will start a web server for the testapp on http://localhost:8888
165165

166-
license
166+
License
167167
=======
168168

169169
[MIT License](https://github.com/allenhwkim/angularjs-google-maps/blob/master/LICENSE)

build/docs/source/custom-control.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
var filtered = parser.filter(attrs);
3434
var options = parser.getOptions(filtered, {scope: scope});
3535
var events = parser.getEvents(scope, filtered);
36+
var innerScope = scope.$new();
3637
/**
3738
* build a custom control element
3839
*/
3940
var customControlEl = element[0].parentElement.removeChild(element[0]);
40-
var content = $transclude();
41-
angular.element(customControlEl).append(content);
41+
var content = $transclude( innerScope, function( clone ) {
42+
element.empty();
43+
element.append( clone );
44+
element.on( '$destroy', function() {
45+
innerScope.$destroy();
46+
});
47+
});
4248
/**
4349
* set events
4450
*/

build/docs/source/places-auto-complete.html

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Example:
1515
* &lt;script src="https://maps.googleapis.com/maps/api/js?libraries=places">&lt;/script>
1616
* &lt;input places-auto-complete types="['geocode']" on-place-changed="myCallback(place)" component-restrictions="{country:'au'}"/>
17+
*
1718
*/
1819
/* global google */
1920
(function() {
@@ -28,6 +29,7 @@
2829
var options = parser.getOptions(filtered, {scope: scope});
2930
var events = parser.getEvents(scope, filtered);
3031
var autocomplete = new google.maps.places.Autocomplete(element[0], options);
32+
autocomplete.setOptions({strictBounds: options.strictBounds === true});
3133
for (var eventName in events) {
3234
google.maps.event.addListener(autocomplete, eventName, events[eventName]);
3335
}
@@ -38,17 +40,32 @@
3840
};
3941
google.maps.event.addListener(autocomplete, 'place_changed', updateModel);
4042
element[0].addEventListener('change', updateModel);
43+
attrs.$observe('rectBounds', function(val) {
44+
if (val) {
45+
var bounds = parser.toOptionValue(val, {key: 'rectBounds'});
46+
autocomplete.setBounds(new google.maps.LatLngBounds(
47+
new google.maps.LatLng(bounds.south_west.lat, bounds.south_west.lng),
48+
new google.maps.LatLng(bounds.north_east.lat, bounds.north_east.lng)));
49+
}
50+
});
51+
attrs.$observe('circleBounds', function(val) {
52+
if (val) {
53+
var bounds = parser.toOptionValue(val, {key: 'circleBounds'});
54+
var circle = new google.maps.Circle(bounds);
55+
autocomplete.setBounds(circle.getBounds());
56+
}
57+
});
4158
attrs.$observe('types', function(val) {
4259
if (val) {
4360
var optionValue = parser.toOptionValue(val, {key: 'types'});
4461
autocomplete.setTypes(optionValue);
4562
}
4663
});
47-
attrs.$observe('componentRestrictions', function (val) {
48-
if (val) {
49-
autocomplete.setComponentRestrictions(scope.$eval(val));
50-
}
51-
});
64+
attrs.$observe('componentRestrictions', function (val) {
65+
if (val) {
66+
autocomplete.setComponentRestrictions(scope.$eval(val));
67+
}
68+
});
5269
};
5370
return {
5471
restrict: 'A',

0 commit comments

Comments
 (0)