Currently, I am developing a component that functions similar to a treeview. Below is the template for my tree-view:
<div>{{templateData?.text}}">1</div>
<div class="row" *ngFor="let child of templateData?.children">
<tree-view [templateData]="child" ></tree-view>
</div>
Within tree-view.component.ts, I have defined templateData as @Input(). Moreover, in app.component.html:
<tree-view [templateData]="templateData"></tree-view>
As for app.component.ts, I retrieve templateData by making an API call:
this.templateService.getTemplateData().subscribe(data => {
this.templateData = data;
});
However, there is an issue where the tree-view component loads before templateData initializes. How can I adjust the component to reload its content once templateData updates?