Display all number's
<span *ngFor="let num of numbers;">
{{num}}
</span>
<br>
<hr>
Display even indexed number only.<br>
<table border="1">
<tr>
<th>Number</th>
<th>isOdd</th>
<th>isEven</th>
</tr>
<tr *ngFor="let num of numbers; let even=even; let odd=odd;">
<td>{{num}}</td>
<td>{{odd}}</td>
<td>{{even}}</td>
</tr>
</table>
<hr>
Display 2 number in row
<table border="1">
<tr>
<th>Col-1</th>
<th>Col-2</th>
</tr>
<ng-container *ngFor="let num of numbers;let ind = index;">
<tr *ngIf="num % 2 === 1">
<td>{{numbers[ind]}}</td>
<td>{{numbers[ind + 1]}}</td>
</tr>
</ng-container>
</table>
first number and last number
<div *ngFor="let num of numbers;let first=first;let last=last;">
<span *ngIf="first">First => {{first}} => {{num}}</span>
<span *ngIf="last">Last => {{last}} => {{num}}</span>
</div>
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
numbers = [
1,2,3,4,5,6,7,8,9,10
];
}