Category:Windows Vista
Category:Windows XPQ:
Dynamically create table for returned json object
I'm using Angular and using $http to get some data.
I know I can create a table using html like this
{{row.id}}
{{row.first_name}}
{{row.last_name}}
{{row.phonenumber}}
{{row.email}}
But now I need to dynamically create the html, based on what I get back. My json looks like this
{
"data": [{
"id": "1",
"first_name": "Steve",
"last_name": "Weiner",
"phonenumber": "555-555-5555",
"email": "steve@example.com"
}, {
"id": "2",
"first_name": "Nick",
"last_name": "Hamburg",
"phonenumber": "555-555-5555",
"email": "nick@example.com"
}]
}
But the issue is how do I create html for these items? I need the data to be in a table, and I need to define each row of the table dynamically.
How can I do this?
A:
You can use ngFor as you mentioned and if you need to be more dynamic you can use ngForTemplate. ac619d1d87
Related links:
Comentários