so I need to sort my table by the duration of the songs and I'm kind of lost, I'm learning Angular so I would appreciate your help. I'll post some of my code.
What I would need is to order the preview column that has the elements.
<div>
<table class="table">
<thead>
<tr>
<th class="styled-tableheader">
Preview
</th>
<th class="styled-tableheader">Like it!</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let track of albumTracks">
<td>
<iframe
[src]="track.uri | domsanitizer"
width="320"
height="90"
frameborder="0"
allowtransparency="true"
allow="encrypted-media"
></iframe>
</td>
<td>
<button (click)="addToPlaylist( track )" type="button" class="myButton">Add to playlist!</button>
</td>
</tr>
</tbody>
</table>
</div>
Here's the component. From here I get the data, the property that I would need from "albumTracks" would be "duration_ms"
getAlbumTracks( id:string ){
debugger;
this.spotify.getAlbumsTracks( id ).subscribe( albumTracks => {
this.albumTracks=albumTracks;
console.log(albumTracks);
} )
}
If you could help, I'll really appreciate it. Thank you very much.