Tree component get nodes sync

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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s