Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.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/2/ionic-framework/2.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
Typescript 从firebase实时数据库筛选数据_Typescript_Ionic Framework_Firebase Realtime Database_Angularfire2 - Fatal编程技术网

Typescript 从firebase实时数据库筛选数据

Typescript 从firebase实时数据库筛选数据,typescript,ionic-framework,firebase-realtime-database,angularfire2,Typescript,Ionic Framework,Firebase Realtime Database,Angularfire2,我正在尝试从firebase获取具有用户用户名值的数据。一周前我尝试了两种不同的方法,但现在我又重新尝试,我注意到我已经删除了它 这里是home.ts中我订阅数据的地方 this.database.list<EventModels>('event-list').valueChanges().subscribe((eventData) => { }, (err)=>{ console.log("Error while retrieving event details

我正在尝试从firebase获取具有用户用户名值的数据。一周前我尝试了两种不同的方法,但现在我又重新尝试,我注意到我已经删除了它

这里是home.ts中我订阅数据的地方

this.database.list<EventModels>('event-list').valueChanges().subscribe((eventData) => { 

}, (err)=>{
 console.log("Error while retrieving event details : ", err);
}); 

this.eventListRef$ = this.database.list<EventModels>('event-list');
this.eventList$ = this.eventListRef$.snapshotChanges()
.pipe(
  map(changes => 
    changes.map(c => ({ id: c.payload.key, ...c.payload.val() }))
  )
);
this.database.list('event-list').valueChanges().subscribe((eventData)=>{
},(错误)=>{
log(“检索事件详细信息时出错:”,err);
}); 
this.eventListRef$=this.database.list('event-list');
this.eventList$=this.eventListRef$.snapshotChanges()
.烟斗(
映射(更改=>
changes.map(c=>({id:c.payload.key,…c.payload.val()}))
)
);
我要筛选的数据等于creator

由于我将creator设置为user's email,因此我只想列出用户通过使用
==firebase.auth().currentUser.email创建的所有事件以及我尝试过的所有失败事件。

来自:

所以看起来你的应该是这样的:

this.eventListRef$ = this.database.list<EventModels>('event-list', 
  ref => firebase.database().ref("event-list").orderByChild("email").equalTo(firebase.auth().currentUser.email));
this.eventListRef$=this.database.list('event-list'),
ref=>firebase.database().ref(“事件列表”).orderByChild(“电子邮件”).equalTo(firebase.auth().currentUser.email));
this.eventListRef$ = this.database.list<EventModels>('event-list', 
  ref => firebase.database().ref("event-list").orderByChild("email").equalTo(firebase.auth().currentUser.email));