Reputation: 99
I have a JSON object returned from my API like this
{
"ID": "GM5VY",
"Passengers": [
{
"Firstname": "TEST",
"Lastname": "TRAVELLER",
"TotalCount": "1",
FqtT": [
{
"MembershipID": "XXXXXX"
}
],
"Errors": null,
"Information": null,
"Warnings": null
}
],
"Errors": null,
"Information": null,
"Warnings": null
}
I'm converting this Object to an array using Pipe filter and trying to display Passengers First Name in View. But I couldn't able to retrieve
<StackLayout *ngFor=" let passengerls of PassengerDetails | objtoarray; let i = index">
<Label [text]="passengerls?.value?.Passengers ? passengerls?.value?.Passengers[i].Firstname:null"> </Label>
</StackLayout>
Please help me in acheiving this!!!
Upvotes: 2
Views: 426
Reputation: 3550
How about using a simpler way to iterate the array:
<StackLayout *ngFor="let passenger of PassengerDetails.Passengers">
<Label [text]="passenger.Firstname"></Label>
</StackLayout>
Upvotes: 2