简体   繁体   中英

Ionic 3 Firestore Document not deleting

I am trying to remove doc from my ionic app but its not working and not showing error . can any one please help how ill remove doc Thanks

   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();
}

I think this will help you.

Try this:

api.ts:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM