答案 0 :(得分:0)
您可以按如下方式创建管道,
@Pipe({name: 'filterByPropertyId'})
export class FilterByPropertyId implements PipeTransform {
transform(yourList: yourObject[], property_id: string): any[] {
if (yourList) {
return yourList.filter((yourList: yourObject) => list.property_id === property_id);
}
}
}
并在组件级别
<div *ngFor="let r of yourList| FilterByPropertyId:propertyId">
</div>