diff --git a/src/core/directives/google-map-circle.ts b/src/core/directives/google-map-circle.ts index f0d063082..e5a67e3e1 100644 --- a/src/core/directives/google-map-circle.ts +++ b/src/core/directives/google-map-circle.ts @@ -247,6 +247,7 @@ export class SebmGoogleMapCircle implements OnInit, OnChanges, OnDestroy { ngOnDestroy() { this._eventSubscriptions.forEach(function(s: Subscription) { s.unsubscribe(); }); this._eventSubscriptions = null; + this._manager.removeCircle(this); } /** diff --git a/src/core/services/managers/circle-manager.ts b/src/core/services/managers/circle-manager.ts index 6c95e1463..1793f587b 100644 --- a/src/core/services/managers/circle-manager.ts +++ b/src/core/services/managers/circle-manager.ts @@ -32,6 +32,16 @@ export class CircleManager { })); }; + /** + * Removes the given circle from the map. + */ + removeCircle(circle: SebmGoogleMapCircle): Promise { + return this._circles.get(circle).then((c) => { + c.setMap(null); + this._circles.delete(circle); + }); + } + setOptions(circle: SebmGoogleMapCircle, options: mapTypes.CircleOptions): Promise { return this._circles.get(circle).then((c) => c.setOptions(options)); };