Skip to content
Advertisement

Populate html table or list with dynamic data from backend

I have a C# api endpoint that returns a List<Dictionary<string, object>>.

The problem here is this list is dynamic, so I cannot say what the elements could be so I could populate an html list (say with angular) with it, i.e.

JavaScript

Another data from the endpoint could have more data and different list properties, so instead of propertyName and propertyValue it could be employeeID, employeeName, dateOfBirth etc.

How do I populate the list with only one list markup and api endpoint?

Advertisement

Answer

If I understand your objective correctly, then in Angular you’ll have the property:

JavaScript

In that case you can:

JavaScript

And in your HTML you can for example:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement