Ionic 3 Firestore 文档未删除

Ionic 3 Firestore Document not deleting

我正在尝试从我的 ionic 应用程序中删除文档,但它无法正常工作,也没有显示错误。任何人都可以帮助删除文档吗谢谢

   home.html
<ion-content padding>
 <ion-list *ngIf="deals">
  <ion-item *ngFor="let x of deals" style="background-color:rgba(0, 0, 0, 
     0.082);" >
  <ion-thumbnail item-left>
    <img [src]="x.photo || './assets/imgs/baby.png'">
   </ion-thumbnail>
   <h2 class="hh">{{x?.name}}</h2>
   <p>{{x?.city}}</p>
   <ion-badge  color="success" *ngIf="x.gender == 'male'">Male</ion-badge>
   <ion-badge  color="warning" *ngIf="x.gender == 'female'">female</ion- 
   badge>

  <button (click)="deleteDeal($event, x)">Delete</button>

    </ion-item>
  </ion-list>
</ion-content>

   home.ts
    deleteDeal(x){
      this.api.deleteDeal(x.id).then(res=>{
        this.helper.toast('childdeleted');
      })
    }

   api.ts 
   deleteDeal(id){
    return this.afs.doc('child/'+id).delete();
}

我想这会对你有所帮助。

试试这个:

api.ts:

deleteDeal(id){
  return this.afs.doc<any>('child/'+id).delete();
}