更新时间:2023-12-03 16:40:10
I got the same issue and found a workaround, although it's not optimal.
You see from the documentation [virtualScroll]
expect an Array. While your this.ads
return an Observable. That's why you got Cannot read property 'length' of null
.
Workaround: Subscribe to it first then display on view (without async pipe), also keep in mind to unsubsribe when done.
ads: any[] = [];
constructor(public adProvider: AdProvider) {
this.adProvider.getActiveAds().valueChanges().subscribe(results => this.ads = results);
}