Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.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
Firestore列表仅显示最新更新的项目(Angular&x2B;Ionic)_Angular_List_Firebase_Ionic Framework_Google Cloud Firestore - Fatal编程技术网

Firestore列表仅显示最新更新的项目(Angular&x2B;Ionic)

Firestore列表仅显示最新更新的项目(Angular&x2B;Ionic),angular,list,firebase,ionic-framework,google-cloud-firestore,Angular,List,Firebase,Ionic Framework,Google Cloud Firestore,我对angular+ionic+firestore有问题。见下面我的代码。我在filteredMarkers()中初始化Items()。但是,每当我更新列表中的项目并返回检查列表时,只有更新的项目显示,而不是整个列表。我在看什么问题?非常感谢你的帮助❤️ 这是我的角度代码: async ionViewWillEnter(){ 控制台日志(“ionViwWillEnter”); 等待此消息。getCurrentLocation(); this.offerList=等待这个.filterMarke

我对angular+ionic+firestore有问题。见下面我的代码。我在filteredMarkers()中初始化Items()。但是,每当我更新列表中的项目并返回检查列表时,只有更新的项目显示,而不是整个列表。我在看什么问题?非常感谢你的帮助❤️

这是我的角度代码:

async ionViewWillEnter(){
控制台日志(“ionViwWillEnter”);
等待此消息。getCurrentLocation();
this.offerList=等待这个.filterMarkers();
}
异步initialiseItems():承诺{
const initialOfferList=this.firestore
.收款(“报价”)
.valueChanges()
.pipe(第一个())
.toPromise();
返回初始报价列表;
}
异步filterMarkers(){
等待此消息。getCurrentLocation();
this.markers=等待this.initialiseItems();
这个.mapsAPILoader.load()。然后(()=>{
console.log(
searchLocation为:“+this.geoLocationService.getLatitude(),
this.geoLocationService.getLongitude()
);
const center=new google.maps.LatLng(
此.geoLocationService.getLatitude(),
this.geoLocationService.getLongitude()
);
//包括距离中心50公里范围内的标记
this.filteredMarkers=this.markers.filter((m)=>{
const markerLoc=new google.maps.LatLng(
m、 位置,纬度,
m、 位置经度
);
常数距离=
google.maps.geometry.spheremic.ComputedDistanceBetween(
马克洛克,
居中
) / 1000;
如果(距离InkM<50.0){
返回m.location;
}
});
});
返回此.filteredMarkers;

}
在您使用的代码中,
.pipe(first())
first()
将仅返回更新文档的first项,因此您仅在执行
valueChanges
时才获得更新文档

您必须使用映射来迭代所有文档