This week, I will continue my plan to find the possibility of helping in the “NG-ZORRO” project. Not long ago, I was looking for a new bug. I will contribute to this bug.
In this study, I found that the questioner raised questions about “Tree component can not get nodes sync , treeService undefined” and uploaded a part of the code.
After looking at the code, I found that the questioner may not be clear about Angular’s knowledge. The description of ‘OnInit’ is “Initialize the directive/component after Angular first displays the data-bound properties and sets the directive/component’s input properties.” It means the clild view/component is not initialized at this stage. The requirement of accessing To the child component at ‘OnInit’ stage is not possible. The correct life-cycle hook should be use is “AfterViewInit – Respond after Angular initializes the component’s views and child views / the view that a directive is in”
To do this, I tried to modify the code. The bug is fixed.
In the future, I hope to continue to help in the “NG-ZORRO” project, and I am not only in this project.