I am using ngFor loop to create a list with buttons to move objects around. I have attempted to use the ngFor variables first and last to disable certain buttons. I am finding "first" does not work
<ul>
<li *ngFor="#hero of heroes; #i=index, #first=first, #last=last">
<button class="btn btn-default btn-lg" [disabled]="first" (click)="moveToTop(hero, i)">Top</button>
<button class="btn btn-default btn-lg" [disabled]="first" (click)="moveUp(hero, i)">Up</button>
<button class="btn btn-default btn-lg" [disabled]="last" (click)="moveDown(hero, i)">Down</button>
<button class="btn btn-default btn-lg" [disabled]="last" (click)="moveToBottom(hero, i)">Bottom</button>
</li>
I have a working example here Plunker preview
Am I doing this correctly? I know I could do
[disabled]="i==0"
but I was thinking "first" and "last" looked more elegant.