Disable the default keyvalue pipe sort in angular

天大地大妈咪最大 提交于 2019-12-05 16:44:18

You need to return 0 if you want them to not be ordered. So in your cause you could either do <td *ngFor="let item of cfValues | keyvalue : 0">

But that would throw a ts error: TypeError: The comparison function must be either a function or undefined

Else, you can create a function that returns 0 and use

function returnZero() {
return 0
}

[... in your template]
<td *ngFor="let item of cfValues | keyvalue : returnZero">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!