diff --git a/src/components/map.ts b/src/components/map.ts index b496476..ac566d6 100644 --- a/src/components/map.ts +++ b/src/components/map.ts @@ -80,7 +80,7 @@ import { MapMarkerDirective } from './map-marker'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush }) -export class MapComponent implements OnChanges, OnInit, OnDestroy { +export class MapComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy { /// /// Field declarations @@ -92,7 +92,7 @@ export class MapComponent implements OnChanges, OnInit, OnDestroy { private _options: IMapOptions = {}; private _box: IBox = null; private _mapPromise: Promise; - @HostBinding('class.map-container') public _containerClass: boolean = true; + @HostBinding('class.map-container') public _containerClass = true; @ViewChild('container') private _container: ElementRef; @ContentChildren(MapMarkerDirective) private _markers: Array; @@ -276,11 +276,19 @@ export class MapComponent implements OnChanges, OnInit, OnDestroy { * @memberof MapComponent */ public ngOnInit(): void { - this.InitMapInstance(this._container.nativeElement); this.MapPromise.emit(this._mapService.MapPromise); this.MapService.emit(this._mapService); } + /** + * Called after Angular has fully initialized a component's view. Part of ng Component life cycle. + * + * @memberof MapComponent + */ + public ngAfterViewInit(): void { + this.InitMapInstance(this._container.nativeElement); + } + /** * Called when changes to the databoud properties occur. Part of the ng Component life cycle. *