1

Following this post : Best approach to create recursive treeview dynamically from data API

I am able to create the recursive tree view from REST API. See Plunker here:

http://plnkr.co/edit/LJhAHne4zA6H0lFog1OI

But there is a problem which I am not able to solve is that. Whenever I Click on the + icon the form get repeated again. I do not want the form to get repeated on every click on +. I want to transfer the value/name which is associated with the + icon to the form.

Thanks in advance.

2
  • I guess you need to move out the form from ContentListComponent to AppComponent or wrap it with an *ngIf="expr" where the expr is only true where you want the form to be shown (perhaps only if it's the root node) Commented Feb 14, 2017 at 10:37
  • 1
    I moved the form to AppComponent and that works. Thanks Commented Feb 14, 2017 at 16:08

1 Answer 1

0

Move the form out of ContentListComponent, for example to AppComponent then it won't be repeated for each node.

Sign up to request clarification or add additional context in comments.

4 Comments

Hi, If I delete some children from the tree on runtime then I don't want to refresh the complete tree and only want to refresh that node and show the new data from the REST API. Thanks
I wouldn't expect it to refresh the complete tree. Perhaps you are replacing an array instead of just adding/removing items. When an array used in *ngFor is replaced, the whole list is re-rendered.
Please edit your question and add the code there. Code in comments is unreadable.
Hi, How can i create a pipe filter in app.component.ts file which filters data by "Name". Example code could be seen in the above Plunker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.