|
78 | 78 | * it must have a container element with ng-non-bindable
|
79 | 79 | */
|
80 | 80 | var template;
|
81 |
| - $q(function(resolve) { |
| 81 | + var templatePromise = $q(function(resolve) { |
82 | 82 | if (angular.isString(element)) {
|
83 | 83 | $templateRequest(element).then(function (requestedTemplate) {
|
84 | 84 | resolve(angular.element(requestedTemplate).wrap('<div>').parent());
|
|
98 | 98 | });
|
99 | 99 |
|
100 | 100 | infoWindow.__open = function(map, scope, anchor) {
|
101 |
| - $timeout(function() { |
102 |
| - anchor && (scope.anchor = anchor); |
103 |
| - var el = $compile(infoWindow.__template)(scope); |
104 |
| - infoWindow.setContent(el[0]); |
105 |
| - scope.$apply(); |
106 |
| - if (anchor && anchor.getPosition) { |
107 |
| - infoWindow.open(map, anchor); |
108 |
| - } else if (anchor && anchor instanceof google.maps.LatLng) { |
109 |
| - infoWindow.open(map); |
110 |
| - infoWindow.setPosition(anchor); |
111 |
| - } else { |
112 |
| - infoWindow.open(map); |
113 |
| - } |
114 |
| - var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement; |
115 |
| - infoWindowContainerEl.className = "ng-map-info-window"; |
| 101 | + templatePromise.then(function() { |
| 102 | + $timeout(function() { |
| 103 | + anchor && (scope.anchor = anchor); |
| 104 | + var el = $compile(infoWindow.__template)(scope); |
| 105 | + infoWindow.setContent(el[0]); |
| 106 | + scope.$apply(); |
| 107 | + if (anchor && anchor.getPosition) { |
| 108 | + infoWindow.open(map, anchor); |
| 109 | + } else if (anchor && anchor instanceof google.maps.LatLng) { |
| 110 | + infoWindow.open(map); |
| 111 | + infoWindow.setPosition(anchor); |
| 112 | + } else { |
| 113 | + infoWindow.open(map); |
| 114 | + } |
| 115 | + var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement; |
| 116 | + infoWindowContainerEl.className = "ng-map-info-window"; |
| 117 | + }); |
116 | 118 | });
|
117 | 119 | };
|
118 | 120 |
|
|
0 commit comments