I have created a tree, in Angular, from an array with property like id and parentId, using the following algorithm:
id
parentId
public setTree(_se