| # |
First Name |
Last Name |
Username |
Role |
Country |
| 1 |
Alexander |
Orton |
@mdorton |
Admin |
USA |
| 2 |
John Deo |
Deo |
@johndeo |
User |
USA |
| 3 |
Randy Orton |
the Bird |
@twitter |
admin |
UK |
| 4 |
Randy Mark |
Ottandy |
@mdothe |
user |
AUS |
| 5 |
Ram Jacob |
Thornton |
@twitter |
admin |
IND |
Installation
npm install @ng-bootstrap/ng-bootstrap
table.html
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Country</th>
<th scope="col">Area</th>
<th scope="col">Population</th>
</tr>
</thead>
<tbody>
@for(country of countries; track country ; let i = $index ){
<tr>
<th scope="row">{{ i + 1 }}</th>
<td>
<img [src]="'https://upload.wikimedia.org/wikipedia/commons/' + country.flag"
class="me-2" style="width: 20px"
/>
{{ country.name }}
</td>
<td>{{ country.area | number }}</td>
<td>{{ country.population | number }}</td>
</tr>
}
</tbody>
</table>
table.ts
import { Component } from '@angular/core';
import { DecimalPipe } from '@angular/common';
interface Country {
name: string;
flag: string;
area: number;
population: number;
}
const COUNTRIES: Country[] = [
{
name: 'Russia',
flag: 'f/f3/Flag_of_Russia.svg',
area: 17075200,
population: 146989754,
},
{
name: 'Canada',
flag: 'c/cf/Flag_of_Canada.svg',
area: 9976140,
population: 36624199,
},
{
name: 'United States',
flag: 'a/a4/Flag_of_the_United_States.svg',
area: 9629091,
population: 324459463,
},
{
name: 'China',
flag: 'f/fa/Flag_of_the_People%27s_Republic_of_China.svg',
area: 9596960,
population: 1409517397,
},
];
@Component({
selector: 'ngbd-table-basic',
imports: [DecimalPipe],
templateUrl: './table-basic.html',
})
export class NgbdTableBasic {
countries = COUNTRIES;
}
Uninstalling Package
npm uninstall @ng-bootstrap/ng-bootstrap