Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何使用anfularfire2/firestore创建分页_Angular_Pagination_Angularfire2 - Fatal编程技术网

Angular 如何使用anfularfire2/firestore创建分页

Angular 如何使用anfularfire2/firestore创建分页,angular,pagination,angularfire2,Angular,Pagination,Angularfire2,我正在尝试创建分页,我希望查询具有动态传递的偏移量和限制(在UI中单击时)的项目。 我用的是收集。是否有任何方法可以从索引和限制(例如5项)开始查询数据 我正在尝试以下方法: 从“angularfire2/firestore”导入{AngularFirestore}; //其他代码 public getData(offsetFrom,offsetTo){ this.fromQuery$=this.db.collection('transactions',(ref)=>( ref.where('

我正在尝试创建分页,我希望查询具有动态传递的偏移量和限制(在UI中单击时)的项目。 我用的是收集。是否有任何方法可以从索引和限制(例如5项)开始查询数据

我正在尝试以下方法:

从“angularfire2/firestore”导入{AngularFirestore};
//其他代码
public getData(offsetFrom,offsetTo){
this.fromQuery$=this.db.collection('transactions',(ref)=>(
ref.where('fromAddress','=',this.fromAddress)
.orderBy('date','asc')
//我想从项目编号开始,但可能无法使用angularfirestore
//其中startAt接受param-字段值
.startAt(3).limit(2)).valueChanges();

}
不可能从索引开始。您必须使用
DocumentSnapshot
startAt
功能。前

publicgetdata(doc:DocumentSnapshot,limit){
this.fromQuery$=this.db.collection('transactions',(ref)=>(
ref.where('fromAddress','=',this.fromAddress)
.orderBy('date','asc')
.startAt(doc).limit(limit)).valueChanges();

}
不可能从索引开始。您必须使用
DocumentSnapshot
startAt
功能。前

publicgetdata(doc:DocumentSnapshot,limit){
this.fromQuery$=this.db.collection('transactions',(ref)=>(
ref.where('fromAddress','=',this.fromAddress)
.orderBy('date','asc')
.startAt(doc).limit(limit)).valueChanges();
}