我正在尝试从离子应用程序中删除文档,但该文档无法正常工作且未显示错误。谁能帮忙删除文档,谢谢
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();
}
答案 0 :(得分:0)
我认为这会对您有所帮助。
尝试一下:
api.ts:
deleteDeal(id){
return this.afs.doc<any>('child/'+id).delete();
}