CirclonGroup / angular-tree-component

A simple yet powerful tree component for Angular (>=2)

Home Page:https://angular2-tree.readme.io/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree is showing updates. Need to click on the screen to show.

lesianocmn opened this issue · comments

Hello,

I have an issue with showing the tree.

Before after adding nodes you could see the information. Now I have to click on the screen to see the tree with the nodes. (if not it continues showing "loading")

I checked and If I add a setTimeout with anything there after change the tree, it is showing again.

    setTimeout(function () {
      let something = 0;
    }, 1400);

I'm missing something or do I have to change something?

Thanks for your help.

How are you adding the nodes? I tried it with the normal getChildren function and also with just resetting the nodes after the page loaded. Both work for me without clicking.

Hello,
Thanks for your comment.
I'm also resetting the nodes and I'm using the getChildren function. I kind find out a solution using ChangeDetectionStrategy OnPush.

I had the same problem. The tree showed after click only.

I tried several workarounds. This works for me:

  constructor(private ref: ChangeDetectorRef){}

  ngOnInit() {
    this.myService.getNodes().subscribe(nodes => {
      this.nodes = [...nodes];
      this.ref.detectChanges();
    });
  }

It worked before I migrated to angular v 12 and material. No idea if there's a connection

Hi @colorcube ,

Yes, It's what I did.. I think it's the only solution by now..