title: PrimeNG tree component
body: <p>I should make a Primeng tree. This is my model.</p>
  <pre><code>export interface Profiles {
    active?: true,
    description?: string,
    function?: [
      string
    ],
    id?: number,
    macroFunction?: string,
    name?: string,
    nodeTree?: [
      {
        children?: [
          string
        ],
        data?: {
          description?: string,
          flag?: true,
          functionFK?: string,
          id?: number,
          order?: number,
          parent?: number
        }
      }
    ]
  }
  </code></pre>
  <p>I don't know how to do the http call and the rest.</p>
  <p>I thought about something like that:
  service:</p>
  <pre><code> postProfiles(): Promise&lt;Profiles &gt; {
      const url = 'profiles/create';
      return this.http.post&lt;Profiles &gt;(url, {})
        .toPromise()
    }
  </code></pre>
  <p>ts --&gt; http</p>
  <pre><code>node: Profile[];
  selectedNode: Profile;
      ngOnInit() {
              this.nodeService.postProfiles().then(node=&gt; this.selectedNode= node);
          }
  </code></pre>
  <p>HTML</p>
  <pre><code>&lt;p-tree [value]=&quot;node&quot; selectionMode=&quot;single&quot; [(selection)]=&quot;selectedNode&quot;&gt;&lt;/p-tree&gt;
  </code></pre>
  <p>Can someone help me? What's wrong?
  Thanks in advance!</p>
  <p><strong>Done! I hope it'll be useful</strong></p>
  <pre><code>node:any; 
  
  this.ricercaService.getTree().subscribe( (res) =&gt; { 
  this.node = res.nodeTree; 
  }, 
  (error) =&gt; { c
  onsole.log(error); 
  });
  </code></pre>
  <p>HTML –</p>
  <pre><code>&lt;p-tree *ngIf=&quot;node&quot; [value]=&quot;node&quot; selectionMode=&quot;checkbox&quot; [(selection)]=&quot;selectedNode&quot;&gt; &lt;ng-template let-node pTemplate=&quot;default&quot;&gt; &lt;b&gt;{{ node.data.description }}&lt;/b&gt; &lt;/ng-template&gt; &lt;/p-tree&gt; – 
  </code></pre>