Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree component can not get nodes sync , treeService undefined #3076

simplejason opened this Issue Mar 12, 2019 · 2 comments


None yet
2 participants
Copy link

simplejason commented Mar 12, 2019

Reproduction link

Steps to reproduce


What is expected?

getTreeNodes() in ngOnInit

What is actually happening?


Environment Info
ng-zorro-antd 7.0.2
Browser chrome

@simplejason simplejason changed the title Tree component can not get nodes sync in ngOnInit Tree component can not get nodes sync , treeService undefined Mar 14, 2019


This comment has been minimized.

Copy link

zdong11 commented Mar 15, 2019

This issue should not be labelled as Bug.

Based on the life-cycle hooks, the nz-tree component is not setup when implement ngOnInit on its parent component. The correct hook could be used is AfterViewInit (Respond after Angular initializes the component's views and child views / the view that a directive is in.)

Please have a test on above stackblitz link and it works to use AfterViewInit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.