Angular 4排序表列
我在此示例的基础上排序表列:
https://plnkr.co/edit/nll91Dbc ... eview
这是一个代码管:
这个代码 html:
在组件中导入:
我想转移管道 Angular 4, 这怎么办吗?
这是控制台中的错误:
</tr></any>
https://plnkr.co/edit/nll91Dbc ... eview
这是一个代码管:
import {Pipe, PipeTransform} from 'angular2/core';
@Pipe/{ name: 'orderBy' }/
export class OrderrByPipe implements PipeTransform {
transform/records: Array<any>, args?: any/: any {
return records.sort/function/a, b/{
if/a[args.property] < b[args.property]/{
return -1 * args.direction;
}
else if/ a[args.property] > b[args.property]/{
return 1 * args.direction;
}
else{
return 0;
}
}/;
};
}
这个代码 html:
<tr *ngfor="let particular of particulars | orderBy: {property: column, direction: direction} | slice:1; let i = index">
在组件中导入:
import { OrderrByPipe } from '../pipes/orderby.pipe';
我想转移管道 Angular 4, 这怎么办吗?
这是控制台中的错误:
error_handler.js:60 Error: Uncaught /in promise/: Error: Error in ./ParticularsListComponent class ParticularsListComponent - inline template:42:14 caused by: Cannot read property 'sort' of undefined
Error: Error in ./ParticularsListComponent class ParticularsListComponent - inline template:42:14 caused by: Cannot read property 'sort' of undefined
</tr></any>
没有找到相关结果
已邀请:
2 个回复
冰洋
赞同来自:
, 哪个未定义。
二哥
赞同来自:
</object></any>