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

Popular posts from this blog

Slip 11: Write node js application that transfer a file as an attachment on web and enables browser to prompt the user to download file using express js.

Slip 7 Create a node js file named main.js for event-driven application. There should be a main loop that listens for events, and then triggers a callback function when one of those events is detected.

Slip 1(a) Write an Angular 13 application addition of two numbers using ng-init, ng-model & ng-bind. And also demonstrate ng-show, ng-disabled, ng-click directives on button component.