Rich
Rich

Reputation: 6561

Access index from *ngFor outside *ngFor

I have this *ngFor inside a div:

<div class="divRow" *ngFor="let userspec of userspecs; let i = index" id="ChosenCar">

Is it possible to access the i outside of the *ngFor? I would like to hide header columns of my table if i <= 0 but the ngFor is on the div for the data rows after the header columns.

Thanks

Upvotes: 0

Views: 1279

Answers (1)

kemsky
kemsky

Reputation: 15261

It is much easier to check *ngIf="userspecs.length <= 0" instead.

Upvotes: 3

Related Questions