I'm working on a component like a treeview. This is my tree-view template:
<div>{{templateData?.text}}">1</div>
<div class="row" *ngFor="let child of templateData?.children">
<tree-view [templateData]="child" ></tree-view>
</div>
I have templateData as @Input() templateData in tree-view.component.ts. And in my app.component.html:
<tree-view [templateData]="templateData"></tree-view>
In app.component.ts, I'm getting templateData by calling api:
this.templateService.getTemplateData().subscribe(data => {
this.templateData = data;
});
But when my tree-view component load, this.templateData hasn't initialized yet, how can I reload the component content when this.templateData updates?
this.templateDataandthis.templateParentDataare same?