Search code examples
htmlcssangularstylesngfor

Apply css to all elements other than first using ngfor


I want to apply CSS to all elements except the first Below is my code and the screenshot of how I want and how I am currently getting

enter image description here --Current

enter image description here --Expected

Code

<div class="row">
      <div class="cell col-md-4">Fann dial readings:</div>
      <div class="cell value caption-bold col-md-2  " ngclass="{'col-md-offset-1' : !$first}" *ngFor='let r of mudCheckWorksheet.rheologyTemperatures'>{{r.t}}°F</div>
  </div>

Solution

  • You need to add first as $first in your ngFor:

     *ngFor='let r of mudCheckWorksheet.rheologyTemperatures; first as $first'
    

    Check more here: NgFor#local-variables