Reputation: 1826
Using Angular 5, I am trying to show all properties of an object.
With a collection of objects such as:
testobjects = [
{"customer": "Me", "ID": "1"},
{"customer": "You", "ID": "2"},
{"customer": "Him", "ID": "3"},
{"customer": "Her", "ID": "4"}
];
and with HTML:
<div *ngFor="let testobject of testobjects">
<span>{{testobject}}</span>
<span>{{testobject.customer}}</span>
</div>
I can get testobject.customer
in the template but not testobject
.
How can I show the entire object?
Upvotes: 0
Views: 80
Reputation: 5257
You can also well format it using the pre tag:
<pre>{{testobject | json }}</pre>
Upvotes: 0