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
115.6k
Regarding call a function using ngFor in Angular 6.
Aug 29 2019 12:38 AM
Dear all,
I hope you are doing well. While creating one component using Angular 6 and ASP .Net MVC I am facing one problem.
I have one one array and I want to print it in a table so for I am using ngFor loop.
I want to call a function for every row. How can I do that?
What I have tried is :-
<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; trackBy:GameName(i)"
>
<td>{{i + 1}}</td>
<td>{{game.game}}</td>
<td>{{game.platform}}</td>
<td>{{game.release}}</td>
</tr>
</table>
in ts :-
GameName(index){
alert(index);
}
If I run above code then it returns undefined for infinite time. I want to cal that function till only length of array.
Please let me know if you have any suggestions.
Thanking you in advance.
Reply
Answers (
3
)
get city,state,country,countrycode,currency value by zipcod
Data retrival from Image