【发布时间】:2020-02-19 13:54:20
【问题描述】:
My code trying to addtodo error on console once i click add to do
只是想知道有没有人知道我将如何将我的 addtodo 存储在我的 todolist 字段中的 house 子集合中 `
todo_title:string;
todo_description: string;
todo_last_date: Date;
todo_owner: string;
constructor(private navCtrl: NavController, private toastCtrl:ToastController) {
this.todo_owner = firebase.auth().currentUser.uid;
}
ngOnInit() {
firebase.firestore().collection("house").doc("this.house.id").collection("toDoList").add({
title: this.todo_title,
description: this.todo_description,
last_date: this.todo_last_date,
owner: this.todo_owner,
created: firebase.firestore.FieldValue.serverTimestamp
()
}).then((docRef) => {
this.toastCtrl.create({
message: "toDo has been added!",
duration: 2000
}).then((toast) => {
toast.present();
this.navCtrl.navigateBack
})
}).catch((err) => {
this.toastCtrl.create({
message: "ToDo has been Added",
duration: 3000
}).then((toast) => {
toast.present();
})
})
}
}`
【问题讨论】:
标签: angular firebase ionic-framework google-cloud-firestore