From 3482df3e417362dfdb337dc2b5c90013ebec8ffb Mon Sep 17 00:00:00 2001 From: Joe Mellon Date: Tue, 9 Jun 2020 15:46:38 +0100 Subject: [PATCH 1/3] ViewChild fix for Angular 9. --- src/components/map.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/map.ts b/src/components/map.ts index b496476..4b77e88 100644 --- a/src/components/map.ts +++ b/src/components/map.ts @@ -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,14 @@ 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); } + public ngAfterViewInit() { + this.InitMapInstance(this._container.nativeElement); + } + /** * Called when changes to the databoud properties occur. Part of the ng Component life cycle. * From 08d675f9ee02e5f8a9b7df37898ba1bcd824772f Mon Sep 17 00:00:00 2001 From: Joe Mellon Date: Wed, 10 Jun 2020 14:44:09 +0100 Subject: [PATCH 2/3] comment --- src/components/map.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/map.ts b/src/components/map.ts index 4b77e88..c17a771 100644 --- a/src/components/map.ts +++ b/src/components/map.ts @@ -280,7 +280,12 @@ export class MapComponent implements OnChanges, OnInit, OnDestroy { this.MapService.emit(this._mapService); } - public ngAfterViewInit() { + /** + * 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); } From f7668454e728c55df7cb671d154a1613079ec365 Mon Sep 17 00:00:00 2001 From: JoeMellon Date: Wed, 12 Aug 2020 14:25:05 +0100 Subject: [PATCH 3/3] Implement AfterViewInit interface to component --- src/components/map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/map.ts b/src/components/map.ts index c17a771..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