我希望每次用户点击查看更多时,我都可以通过更改.limit
过滤器来更改我显示的项目数。问题是当我更改变量时,.limit
似乎没有更新。这是一个已知的问题吗?
打字稿
clicks = 1;
this.activitiesCollection = this.afs.collection(activitiesPath, ref => {
return ref.orderBy('date', 'desc').limit(3 * this.clicks) //NOT CHANGING
});
this.activities = this.activitiesCollection.valueChanges();
clicker() {
this.clicks++;
console.log(this.clicks) //UPDATING VARIABLE COUNT PROPERLY
}
HTML
<div *ngFor="let activity of activities | async">
{{activity.name}}
</div>
<button (click)="clicker()">View more</button>