title: How to access previous/later elements within an ngFor loop?
body: <pre><code>&lt;div *ngFor="let item of list"&gt;
    &lt;div *ngIf="item == previousItem"&gt;&lt;/div&gt;
    &lt;div *ngIf="item == firstItem"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How can we make this type of thing work? That is, how can we access other items in the list either (1) in relation to the current index or (2) by absolute index?</p>
  
  <p>EDIT: What if the list was instead an Observable?</p>
  
  <pre><code>&lt;div *ngFor="let item of observable"&gt;
    &lt;div *ngIf="item == previousItem"&gt;&lt;/div&gt;
    &lt;div *ngIf="item == firstItem"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>