I'm trying to output JSON values in HTML using ngFor without specifying the object name to render the value in HTML, is this even possible?
I know that I have to specify the object name to actually render the value like the example below.
Let's say I have this JSON object:
'customerObjs':'Ob1'
'FirstName': 'Name'
'Something': 'Something'
And in HTML, I have to do something like the code below to show the value,
<div *ngFor="let obj of Objects">
{{ obj.FirstName }}
</div>
However, the idea is to render the value even if you don't know the object name. Because what if the backend guy added a new object of YouDontKnowWhatThisIs then the HTML should still render the value of that YouDontKnowWhatThisIs.
So it's more of dynamically outputting the response with hard coding the object name.
Is this possible? If so can someone show an example?
customerObjs, actually it is a list and not an object. It wont even work because it is an invalid JSON. But, try to use the json pipe like: {{obj | json}} so you will see all object fields.<pre>{{ Objects | json:true }}</pre>