@@ -2290,13 +2290,19 @@ Nicholas McCready - https://twitter.com/nmccready
2290
2290
break ;
2291
2291
case 'options' :
2292
2292
if ( this . validateCoords ( scope . coords ) && ( scope . icon != null ) && scope . options ) {
2293
- return this . scope . gMarker . setMap ( null ) ( this . scope . gMarker != null ? this . setGMarker ( new google . maps . Marker ( this . createMarkerOptions ( scope . coords , scope . icon , scope . options , this . mapCtrl . getMap ( ) ) ) ) : void 0 ) ;
2293
+ if ( this . scope . gMarker != null ) {
2294
+ this . scope . gMarker . setMap ( null ) ;
2295
+ }
2296
+ return this . setGMarker ( new google . maps . Marker ( this . createMarkerOptions ( scope . coords , scope . icon , scope . options , this . mapCtrl . getMap ( ) ) ) ) ;
2294
2297
}
2295
2298
}
2296
2299
} ;
2297
2300
2298
2301
MarkerParentModel . prototype . setGMarker = function ( gMarker ) {
2299
- delete this . scope . gMarker ;
2302
+ if ( this . scope . gMarker ) {
2303
+ delete this . scope . gMarker ;
2304
+ this . gMarkerManager . remove ( this . scope . gMarker , false ) ;
2305
+ }
2300
2306
this . scope . gMarker = gMarker ;
2301
2307
if ( this . scope . gMarker ) {
2302
2308
this . gMarkerManager . add ( this . scope . gMarker , false ) ;
@@ -2308,11 +2314,12 @@ Nicholas McCready - https://twitter.com/nmccready
2308
2314
2309
2315
MarkerParentModel . prototype . onDestroy = function ( scope ) {
2310
2316
var self ;
2311
- if ( this . scope . gMarker === void 0 ) {
2317
+ if ( ! this . scope . gMarker ) {
2312
2318
self = void 0 ;
2313
2319
return ;
2314
2320
}
2315
2321
this . scope . gMarker . setMap ( null ) ;
2322
+ this . gMarkerManager . remove ( this . scope . gMarker , false ) ;
2316
2323
delete this . scope . gMarker ;
2317
2324
return self = void 0 ;
2318
2325
} ;
0 commit comments