From fe798e3f6023e6db6551b4b7cfad52e190e3fe91 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Mon, 5 Oct 2020 11:08:36 +0200 Subject: [PATCH] Fix AW-1508 --- .../aol/item-layers/item-layers.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts index 468bbac..adbc501 100644 --- a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts @@ -31,6 +31,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange @Input() itemLayers: IItemLayer[]; @Input() itemLayer: IItemLayer; private _apiEndPoint: string; + private initialized:boolean = false; constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) { super(map); @@ -273,7 +274,14 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange ngOnInit() { super.ngOnInit(); - this.updateLayers(this.itemLayers); + if(this.itemLayers) { + this.updateLayers(this.itemLayers); + } else if(this.itemLayer) { + this.updateLayers([this.itemLayer]) + } else { + this.updateLayers([]); + } + this.initialized=true; } addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer { @@ -326,7 +334,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange } ngOnChanges(changes: SimpleChanges) { - if (this.instance) { + if (this.instance && this.initialized) { if (changes['itemLayers']) { var itemLayers = changes['itemLayers'].currentValue as IItemLayer[]; this.updateLayers(itemLayers);