Dynamically loaded component does not get updated on context change
Closed this issue · 2 comments
ciukstar commented
When the context ctx
gets updated, the underlying component, defined by components.get(tmpl['component'])['component']
does not get updated (its ngOnChanges
does not get called).
Everything works fine on first load. What should I do in order to get changes propagated downward?
Here is the component definition:
@Component({
selector: 'app-layout-three-host-component',
template: `
<ng-container
*ngxComponentOutlet="components.get(tmpl['component'])['component']; context: ctx;">
</ng-container>
`
})
export class LayoutThreeHostComponent implements OnChanges {
@Input() tmpl: ChartTemplate;
@Input() ctx: any;
@Input() components: Map<string, { component: Type<any>; context: (x: ChartTemplate) => Observable<any> }>;
ngOnChanges(changes: SimpleChanges) {
console.log('LayoutThreeHostComponent: changes: ', changes);
}
}
Thanks!
thekiba commented
Hello, thanks for issue!
Seems interesting. Can you try to repeat that problem on stackblitz and put the link here?
ciukstar commented
Sorry. It seems to be a change detection issue (deep change). I have changes in a deep json structure. I expected that the reassignment itself would trigger the rebounding of the context params.