|
| 1 | +'use strict'; |
| 2 | + |
1 | 3 | (function () { |
2 | 4 | var app = angular.module('ui.map', ['ui.event']); |
3 | 5 |
|
4 | 6 | //Setup map events from a google map object to trigger on a given element too, |
5 | 7 | //then we just use ui-event to catch events from an element |
6 | 8 | function bindMapEvents(scope, eventsStr, googleObject, element) { |
7 | 9 | angular.forEach(eventsStr.split(' '), function (eventName) { |
8 | | - //Prefix all googlemap events with 'map-', so eg 'click' |
| 10 | + //Prefix all googlemap events with 'map-', so eg 'click' |
9 | 11 | //for the googlemap doesn't interfere with a normal 'click' event |
10 | | - google.maps.event.addListener(googleObject, eventName, function (event) { |
| 12 | + window.google.maps.event.addListener(googleObject, eventName, function (event) { |
11 | 13 | element.triggerHandler('map-' + eventName, event); |
12 | 14 | //We create an $apply if it isn't happening. we need better support for this |
13 | 15 | //We don't want to use timeout because tons of these events fire at once, |
|
31 | 33 | //doesn't work as E for unknown reason |
32 | 34 | link: function (scope, elm, attrs) { |
33 | 35 | var opts = angular.extend({}, options, scope.$eval(attrs.uiOptions)); |
34 | | - var map = new google.maps.Map(elm[0], opts); |
| 36 | + var map = new window.google.maps.Map(elm[0], opts); |
35 | 37 | var model = $parse(attrs.uiMap); |
36 | 38 |
|
37 | 39 | //Set scope variable for the map |
|
57 | 59 | var infoWindow = model(scope); |
58 | 60 |
|
59 | 61 | if (!infoWindow) { |
60 | | - infoWindow = new google.maps.InfoWindow(opts); |
| 62 | + infoWindow = new window.google.maps.InfoWindow(opts); |
61 | 63 | model.assign(scope, infoWindow); |
62 | 64 | } |
63 | 65 |
|
|
79 | 81 | }; |
80 | 82 | }]); |
81 | 83 |
|
82 | | - /* |
| 84 | + /* |
83 | 85 | * Map overlay directives all work the same. Take map marker for example |
84 | 86 | * <ui-map-marker="myMarker"> will $watch 'myMarker' and each time it changes, |
85 | 87 | * it will hook up myMarker's events to the directive dom element. Then |
|
0 commit comments