title: Angular 7 - Make Last Item in Array A Link Using ngFor
body: <p>I have a list of menu items and I want to make the last item in the array a link. </p>
  
  <p>Right now the menu items are built from a component, but I'm unsure of how to make the last item in the array a link.</p>
  
  <p><strong>ActionMenuItem.component.html</strong></p>
  
  <pre><code>  &lt;div *ngIf="expanded"&gt;
    &lt;actionmenuitem *ngFor="let child of line.children" [line]="child" (inWorkspace)="toWorkspace($event)"&gt;&lt;/actionmenuitem&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>ActionMenuItem.Component.ts</strong></p>
  
  <pre><code>  onSelect(){
  // If it has children, expand them &amp;&amp; flip carat.
  if(this.line.children.length &gt; 0){
  
    this.expanded = !this.expanded;
  
    if(this.iconName == "expand_more"){
      this.iconName = "expand_less"
    } else {
      this.iconName = "expand_more"
    }
  
  } else {
    this.inWorkspace.emit(this.line);
  }
  </code></pre>