Firestore的动态限制?

时间:2018-02-17 08:00:31

标签: angular google-cloud-firestore angularfire2

我希望每次用户点击查看更多时,我都可以通过更改.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>

1 个答案:

答案 0 :(得分:0)

问题发布在Github上,回复here