I have a template that looks like this.
<ng-container *ngIf="contactList$ | async as contactList">
<ion-virtual-scroll [items]="contactList">
<ion-item *virtualItem="let c" (click)="openProfile(c)">
<ion-thumbnail slot="start">
<img [src]="c.profilePicture" />
</ion-thumbnail>
<ion-label position="stacked">{{ c.lastNames }}, {{ c.firstNames }}</ion-label>
<ion-label position="stacked">{{ c.mutualFriends[lastNames] }}</ion-label>
</ion-item>
</ion-virtual-scroll>
</ng-container>
and depending on how I modify the subscription to an observable depends on weather or not I can see the Object of an Array's sub Array. In this example c.mutualFriends[name]
is a sub Array that has additional information. mutualFriends
is an Array of Objects (an example is below).
now in the component I was previously doing:
this.contactService.getContacts().subscribe((users: Contact[]): void => {
this.contactList = users;
});
side note: I know that with this way you need to alter the template above in order not to get errors. in this case delete the <ng-container>
When getting the values this way the array of strings in c.mutualFriends[lastNames]
will be listed. after subscribing to the observable this way:
this.contactList$ = this.contactService.getContacts();
inside the template the c.mutualFriends[lastNames]
nothing is listed.
How can I render from the example below:
contact = {
lastNames: 'Garcia Smith',
firstNames: 'Gabriel',
mutualFriends: [
{
lastNames: 'Llull',
firstNames: 'Ramon',
mutualFriends[],
},
{
lastNames: 'Pereira dos Santos',
firstNames: 'Joāo Maria',
mutualFriends: [],
}
],
};
in my template I want to see 'Llull, Pereira dos Santos'
like I could with the first way of subscribing.
I hope this was enough detail. thanks for your help!