home.ts 通过按键从ionic4中删除Firebase列表中的项目
export class HomePage {
shop : AngularFireList<any>;
shopadd : Observable<any[]>;
constructor(
public navCtrl: NavController,
public db: AngularFireDatabase,
public navParams: NavParams,
public auth: AngularFireAuth
){
this.shopadd = this.db.list('/market').valueChanges();
this.shopadd = this.db.list('/market').snapshotChanges().map(changes => {
return changes.map(c => ({ key: c.payload.key, ...c.payload.val()
}));
});
}
这不起作用
delete(key){this.shop.remove(key);}}
home.html中的此按钮
<button ion-button clear item-end (click)="delete(shopadd.key)"> delete </button>