我有一个非常基本的问题,但我不知道做到这一点的最佳方法。我的问题是单击要发送数据并从服务器获取相同数据的按钮。在某些情况下,我的后端可以花时间将数据存储在数据库中,而当我检索数据时,无需进行最后更改即可提取数据。
storeCategory() {
this.categoryService.storeCategory(this.currentFileUpload, this.category).subscribe();
this.adminService.getCategoryFromServer();
有人知道有建议吗?
答案 0 :(得分:0)
存储完成后,您需要通过将getCategoryFromServer()
放在subscribe()
的{{1}}中来检索数据:
storeCategory(this.currentFileUpload, this.category)
这样,您应该获得最新的更改。