Basic working version

This commit is contained in:
Willem Dantuma
2020-03-02 13:48:10 +01:00
parent 60c741d935
commit 5343a4aa98
10 changed files with 154 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleCh
import { IItem } from '@farmmaps/common';
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import { IItemLayer } from '../../models/item.layer';
@Component({
@@ -15,6 +16,7 @@ export class SelectedItemContainerComponent {
}
@Input() item: IItem;
@Input() itemLayer:IItemLayer
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
@@ -41,11 +43,15 @@ export class SelectedItemContainerComponent {
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
(<AbstractSelectedItemComponent>componentRef.instance).itemLayer = this.itemLayer;
}
ngOnChanges(changes: SimpleChanges) {
if (changes["item"] && changes["item"].currentValue) {
this.loadComponent();
}
if (changes["itemLayer"] && changes["itemLayer"].currentValue) {
this.loadComponent();
}
}
}