How to create an Angular table in Angular 11|12 ?
Sat Jan 08 2022 13:19:11 GMT+0000 (Coordinated Universal Time)
Saved by
@bronius
import { Component, OnInit } from '@angular/core';
export interface IStudent {
name: string;
gender: string;
country: string;
}
@Component({
selector: 'app-regular-table',
templateUrl: './regular-table.component.html',
styleUrls: ['./regular-table.component.scss']
})
export class RegularTableComponent implements OnInit {
students: IStudent[];
ngOnInit(): void {
fetch('./assets/data/students.json').then(res => res.json())
.then(json => {
this.students = json;
});
}
}
content_copyCOPY
https://edupala.com/how-to-create-angular-table/
Comments