【发布时间】:2021-03-12 04:23:39
【问题描述】:
我在 Firestore 中创建了一个集合“票证”。我想当我更新数据时会在子集合'action'中添加动作,但没有像图片字段'actionSentence'数据这样的数据没有输入
app.ts
isSubmitAssignDev() {
if (this.editTicket.controls.assign.value) {
this.ticketService.setActionById(this.id, this.editTicket.controls.status.value, this.editTicket.controls.assign.value)
}
}
setActionSentence() {
if (this.status.value === 'Accepted') {
this.editTicket.patchValue({
actionSentence: 'MA accepted ticket'
})
} else if (this.status.value === 'Rejected') {
this.editTicket.patchValue({
actionSentence: 'MA rejected ticket'
})
} else if (this.status.value === 'Pending') {
this.editTicket.patchValue({
actionSentence: 'MA set pending'
})
} else if (this.status.value === 'Assigned') {
this.editTicket.patchValue({
actionSentence: 'Supervidor assigned ticket'
})
} else if (this.status.value === 'Resolved') {
this.editTicket.patchValue({
actionSentence: 'Dev resoled task'
})
}
}
app.service.ts
setActionById(id: any, status: any, staff: any, actionSEntence: any) {
this.afs.collection('ticket').doc(id)
.collection('action')
.add({
actionSEntence,
staff,
status,
date: new Date(),
})
}
【问题讨论】:
标签: angular google-cloud-firestore angular8