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

Closed
simplejason opened this issue Mar 12, 2019 · 2 comments
Closed

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

simplejason opened this issue Mar 12, 2019 · 2 comments

Comments

@simplejason
Copy link
Member

Reproduction link

https://stackblitz.com/edit/angular-qwlewn?file=src/app/app.component.ts

Steps to reproduce

above

What is expected?

getTreeNodes() in ngOnInit

What is actually happening?

empty

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
@zdong11
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.

@zdong11
Copy link

zdong11 commented Mar 15, 2019

Ricbet pushed a commit to Ricbet/ng-zorro-antd that referenced this issue Apr 9, 2020
* fix(module: tree): fix nzMultiple and rollback code

* fix(module: tree): fix spec and export service

fix(module: tree): fix doc

* fix(module: tree): fix code bug

* fix(module: tree): fix treeService error and code merge

* fix(module: tree): fix strict code style

* fix(module: tree): fix strict spec code

* fix(module: tree): remove unnecessary demo code

* fix(module: tree): fix doc and demo

* fix(module: tree): add notice doc

close NG-ZORRO#3076
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
* fix(module: tree): fix nzMultiple and rollback code

* fix(module: tree): fix spec and export service

fix(module: tree): fix doc

* fix(module: tree): fix code bug

* fix(module: tree): fix treeService error and code merge

* fix(module: tree): fix strict code style

* fix(module: tree): fix strict spec code

* fix(module: tree): remove unnecessary demo code

* fix(module: tree): fix doc and demo

* fix(module: tree): add notice doc

close NG-ZORRO#3076
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants