TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mandar Shinde
NA
423
114.7k
Print table using two ngFor loop
Aug 26 2019 1:26 AM
Dear all,
Hope you are doing well. I was developing one component using Angular 7 and ASP .net MVC with REST api. Table code :-
<table
class
=
"table"
>
<tr>
<th>#</th>
<th>Game</th>
<th>Platform</th>
<th>Release</th>
</tr>
<tr *ngFor=
"let game of games; let i = index"
>
<td>{{i + 1}}</td>
<td>{{game.game}}</td>
<td>{{game.platform}}</td>
<td>{{game.release}}</td>
</tr>
</table>
How can I print this data more dynamically l mean if I have get headers which I want am bringing from database.
what I have tried is that :-
<table
class
=
"table"
>
<tr>
<th>#</th>
<th *ngFor=
"let header of headers;"
>
{{ header[
'HeaderName'
] }}
</th>
</tr>
<tr *ngFor=
"let game of games; let i = index"
>
<td>{{i + 1}}</td>
<td>{{game[i][header]}}</td>
</tr>
</table>
Here I am able to see table headers only not table data.
How can I overcome on above problem.
Thanking you in advance.
Regards.
Reply
Answers (
2
)
drop-down in angularjs
Download HTML Content as PDF