Fix AW-1508
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good Details

2022.01
Willem Dantuma 2020-10-05 11:08:36 +02:00
parent b8dcc4e9e0
commit fe798e3f60
1 changed files with 10 additions and 2 deletions

View File

@ -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);