Apply css to all elements other than first using ngfor

Apply css to all elements other than first using ngfor

Problem Description:

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 – 1

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

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject