我正在尝试从服务中获取数据到下面的组件是我的服务
服务.ts
export class PrjService {
tDate: Observable<filModel[]>;
prjData:Observable<filModel[]>;
entityUrl;
constructor(){
this.entityUrl = 'PrjDetail/GetByRep';
this.tDate = service.get<ShipDateFilterModel[]>(this.entityUrl);
}
我尝试检索的组件如下所示
export class RFComponent implements OnInit {
cachedResults: any[];
shipToData: any;
constructor(private psService: PrjService)
{}
ngOnInit() {
this.psService.tDate.subscribe(x => this.cachedResults = x);
this.filterData = [...new Set(this.cachedResults.map(item => item.cus_name))].filter(Boolean);
}
这里每当对服务的调用this.cachedResults是未定义的,我在下面收到错误,就像我试图过滤的地方
错误类型错误:无法读取未定义的属性“地图”
不确定我在这里缺少什么
呼如林
相关分类