My task involves sorting an array of objects based on the response from the first API call in ascending order. The initial API call returns a list of arrays which will be used for the subsequent API call.
The first API call fetches something like this:
[0001,0002,0003,0004,0005]
I then iterate over these story IDs and pass them into the card component:
<div *ngFor="let id of storyIds | slice: start:end">
<app-cards [id]="id"></app-cards>
</div>
Once the second API is called based on the IDs from the card component, it returns responses for each ID:
{name: 'John', score: 1}
{name: 'Jane', score: 99}
{name: 'Joe', score: 53}
At this point, I am trying to figure out how to sort these items based on the scores provided by the second API call. One approach could involve pushing each object into an array and sorting this new array of objects.