@@ -184,7 +184,7 @@ <h1 class="title">
184
184
* @desc map instance pool
185
185
*/
186
186
var mapInstances = [];
187
- var $window, $document;
187
+ var $window, $document, $timeout ;
188
188
var add = function(el) {
189
189
var mapDiv = $document.createElement("div");
190
190
mapDiv.style.width = "100%";
@@ -217,6 +217,11 @@ <h1 class="title">
217
217
var map = find(el);
218
218
if (!map) {
219
219
map = add(el);
220
+ } else {
221
+ /* firing map idle event, which is used by map controller */
222
+ $timeout(function() {
223
+ google.maps.event.trigger(map, 'idle');
224
+ }, 100);
220
225
}
221
226
map.inUse = true;
222
227
return map;
@@ -231,15 +236,15 @@ <h1 class="title">
231
236
var returnMapInstance = function(map) {
232
237
map.inUse = false;
233
238
};
234
- var NgMapPool = function(_$document_, _$window_) {
235
- $document = _$document_[0], $window = _$window_;
239
+ var NgMapPool = function(_$document_, _$window_, _$timeout_ ) {
240
+ $document = _$document_[0], $window = _$window_, $timeout = _$timeout_ ;
236
241
return {
237
242
mapInstances: mapInstances,
238
243
getMapInstance: getMapInstance,
239
244
returnMapInstance: returnMapInstance
240
245
};
241
246
};
242
- NgMapPool.$inject = [ '$document', '$window' ];
247
+ NgMapPool.$inject = [ '$document', '$window', '$timeout' ];
243
248
angular.module('ngMap').factory('NgMapPool', NgMapPool);
244
249
})();
245
250
</ code > </ pre >
0 commit comments