Abd*_*hid 4 angular-pipe angular
<tr *ngFor="let a of arrayOfObjects">
<td *ngFor="let item of cfValues | keyvalue">
{{item.value}}
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我只是想按常规顺序打印项目,但是键/值管道会根据索引进行默认排序。有没有办法禁用默认排序?
alb*_*esi 17
如果您不希望订购它们,则需要返回0。因此,您可以这样做
<td *ngFor="let item of cfValues | keyvalue : 0">
但这会引发ts错误: TypeError: The comparison function must be either a function or undefined
否则,您可以创建一个返回0的函数并使用
function returnZero() {
return 0
}
[... in your template]
<td *ngFor="let item of cfValues | keyvalue : returnZero">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
973 次 |
| 最近记录: |