我试图获取一个表的所有数据,并对其做一个Excel。我有几个问题。我用的是赖斯特尔公司的服务。我在getAll中做了一个quotation.service.ts函数
getAll(): Observable<Quotation[]> {
return this.rg.all('quotations').getList();
}当我试图得到它时,我在我的component.ts中这样做:
exportAsXLSX(): void {
this.quotationService.getAll()
.subscribe(quotations => this.quotations = quotations);
//console.log(this.quotations);
}当我尝试访问this.quotations时,它是未定义的。然后我试着:
exportAsXLSX(): void {
this.quotationService.getAll()
.subscribe(quotations => console.log(quotations ));
//console.log(this.quotations);
}我得到了一个结果,但当我想让我的所有行(~1400)执行Excel时,结果最多只能达到30个。我不明白为什么我只得到30个结果,以及为什么当我试图访问this.quotations时,它是未定义的。
编辑:所以30个最大的结果确实是因为API。但我仍然有个问题
console.log(this.quotations);
是未定义的,当我可以检查报价是正确的数据时,我正在寻找。
邮递员的数据是这样的,但我不会把所有的东西都放进去,因为有私人的数据:
{
"data": {
"@context": "/api/contexts/Quotation",
"@id": "/api/quotations",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/api/quotations/1",发布于 2021-07-09 14:03:12
好了我终于拿到了。我用过
@Input() quotations: Quotation[];在我的component.ts中当我应该使用
quotations: Quotation[];现在工作得很好。
https://stackoverflow.com/questions/68315595
复制相似问题