I would like to know how I can access only the very first element of an array at my angular template?
Currently, this is my situation:
<div *ngFor="let machine of machines">
<span>Released <small>{{ machine.release_date }}</small></span>
</div>
this will print the release date 3x times, or the number of element I have in the array, where I only want the first.
Thanks in advance
CodePudding user response:
simply
<div *ngFor="let machine of machines; let first = first">
<span *ngIf="first">Released <small>{{ machine.release_date }}</small>
</span>
</div>