angular - 在Angular中对表格行进行排序
问题描述
所以我需要按歌曲的持续时间对我的桌子进行排序,我有点迷茫,我正在学习 Angular,所以我会感谢你的帮助。我会发布一些我的代码。
我需要的是订购包含元素的预览列。
<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>
这是组件。从这里我得到数据,我需要来自“albumTracks”的属性是“duration_ms”
getAlbumTracks( id:string ){
debugger;
this.spotify.getAlbumsTracks( id ).subscribe( albumTracks => {
this.albumTracks=albumTracks;
console.log(albumTracks);
} )
}
如果您能提供帮助,我将不胜感激。非常感谢。
解决方案
推荐阅读
- focus - mate桌面环境marco窗口管理器窗口焦点不起作用
- postgresql - 如何在烧瓶测试中创建测试 Postgres 数据库
- python - 附加函数将元素添加到列表成员
- python - python中的“测试用例失败”是什么?
- go - 如何使用“golang.org/x/net/icmp”获取 icmp(ping) 目标 IP 地址
- microsoft-graph-api - 如何使用 Microsoft Graph 中的对话 ID 从线程中获取电子邮件内容(包括附件,如果有)?
- javascript - 如何根据结构中具有多个键的子值通过 Rest API 检索 Firebase 中的记录?
- mysql - 意外类型,期望名称
- python - 从电子邮件数据库列表中提取域
- c# - 如何在自定义 AuthenticationHandler 中自定义错误代码