按键删除Firebase对象

时间:2018-07-09 15:01:22

标签: angular firebase firebase-realtime-database angularfire2

我使用angular CLI 6和angularfirebase 2。

我的组件中有很多耐心的PPS数据。我想通过他们自己的Firebase密钥删除每个PPS,但是在这里我删除了应用程序的所有PPS。谁能说我怎么了?谢谢!

Component.ts     ngOnInit(){

   this.route.params.forEach((urlParameters) => {
   this.patientid = urlParameters['id'];});
   this.ppssToDisplay = this.ppssService.getPPSByPatientid(this.patientid);

   removePPS(this): void { this.ppssService.deletePPS(this.key)};

Component.thml     

    <button mat-icon-button  (click)="removePPS()"><mat-icon class="example-icon">delete </mat-icon></button>&nbsp;
</div>

Service.ts

getPPSByPatientid(Patientid: string){
return this.database.list('/ppss', ref => ref.orderByChild("Patientid").equalTo(Patientid)).valueChanges();
}

deletePPS(key: string){
return this.ppss.remove(key);
}

0 个答案:

没有答案
相关问题