title: How to access a Method in angular view with out resulting multiple calls?
body: <pre><code>   &lt;ng-container *ngFor="let child of root.getChildren()"&gt;
     &lt;ng-container id="prefix" *ngIf="hasPrefix(child)"&gt;
     {{getPrefix(child)}}
     &lt;/ng-container&gt;
     &lt;/ng-container&gt;
  </code></pre>
  
  <p>I am just learning angular. I don't have much experience with angular. Please feel free to correct me if I am wrong.</p>
  
  <p>I have a tree data structure, where I have to traverse through the tree and print the prefix of child nodes. But the prefix is a private property. What is the best practice in angular to access the private properties in the view component? The above code leads to multiple method calls as there will be a change detected during recursion.</p>
  
  <p>Thanks in advance.</p>