diff --git a/src/core/directives/google-map-info-window.ts b/src/core/directives/google-map-info-window.ts index a243bfa3a..b9c7b0200 100644 --- a/src/core/directives/google-map-info-window.ts +++ b/src/core/directives/google-map-info-window.ts @@ -35,7 +35,7 @@ let infoWindowId = 0; */ @Component({ selector: 'sebm-google-map-info-window', - inputs: ['latitude', 'longitude', 'disableAutoPan'], + inputs: ['latitude', 'longitude', 'disableAutoPan', 'isOpen'], outputs: ['infoWindowClose'], template: `
@@ -87,6 +87,11 @@ export class SebmGoogleMapInfoWindow implements OnDestroy, */ content: Node; + /** + * Sets the open state for the InfoWindow. You can also call the open() and close() methods. + */ + isOpen: boolean = false; + /** * Emits an event when the info window is closed. */ @@ -102,6 +107,7 @@ export class SebmGoogleMapInfoWindow implements OnDestroy, this.content = this._el.nativeElement.querySelector('.sebm-google-map-info-window-content'); this._infoWindowManager.addInfoWindow(this); this._infoWindowAddedToManager = true; + this._updateOpenState(); } /** @internal */ @@ -116,9 +122,16 @@ export class SebmGoogleMapInfoWindow implements OnDestroy, if (changes['zIndex']) { this._infoWindowManager.setZIndex(this); } + if (changes['isOpen']) { + this._updateOpenState(); + } this._setInfoWindowOptions(changes); } + private _updateOpenState() { + this.isOpen ? this._infoWindowManager.open(this) : this._infoWindowManager.close(this); + } + private _setInfoWindowOptions(changes: {[key: string]: SimpleChange}) { let options: {[propName: string]: any} = {}; let optionKeys = Object.keys(changes).filter(