Fix AW-1508
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-10-05 11:08:36 +02:00
parent b8dcc4e9e0
commit fe798e3f60

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