[英]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
谁能帮忙请问如何删除doc谢谢
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: api.ts:
deleteDeal(id){
return this.afs.doc<any>('child/'+id).delete();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.