Using angular js display the 10 student details in Table format (using ng-repeat directive use Array to store data)
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'student';
students=[
{ id:1,name:'sonu',course:'FYBSc',marks:60 },
{ id:2,name:'Ram',course:'FYBSc',marks:60 },
{ id:1,name:'sonu',course:'FYBSc',marks:60 }
];
}
app.component.html
<h2>Student data</h2>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Course</th>
<th>Marks</th>
</tr>
<tr *ngFor="let s of students">
<td>{{ s.id }}</td>
<td>{{ s.name }}</td>
<td>{{ s.course }}</td>
<td>{{ s.marks }}</td>
</tr>
</table>
Comments
Post a Comment