0
我想實現一個非常簡單的管道,它從* ngFor獲取數據,然後執行一些操作,但是當我在執行data.filter()時,它會拋出一個錯誤「看不懂的undfined屬性過濾器」角2管道數據沒有傳遞到變換方法
這裏是我管
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'tripFilterByStartDate',pure: false })
export class tripFilterByStartDateModule implements PipeTransform {
transform(values: any, args: any[] = null) {
console.log(values);//
return values.filter(value => value.someValue);// throwing an error "cannot read property filter of undefined"
}
}
,這裏是我的html頁面
<ion-card *ngFor="let tripData of tripList | tripFilterByStartDate" text-wrap>
</ion-card>
任何建議將是很大的幫助
感謝pankaj,它現在工作的很好。 – Abhijeet