I want to loop over an object and display every object in a different tag.
For example, if I have this array:
x = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]
I want to display something like this:
first: 1
second: 2
first: 3
second: 4
I tried this:
<ng-container *ngFor="let p of x">
<div>
<label for="recipient-a" class="col-form-label">first:</label>
<input class="form-control" id="recipient-a" type="text" name="a" #name="ngModel" [(ngModel)]="p.a">
</div>
<div>
<label for="recipient-b" class="col-form-label">second:</label>
<input class="form-control" id="recipient-b" type="text" name="b" #name="ngModel" [(ngModel)]="p.b">
</div>
</ng-container>
But this will display only the second element:
first: 3
second: 4
first: 3
second: 4
How can I modify the code to achieve what I want? Thank you for your time!