product-operations.component.ts
deleteProduct() {
this.productsService.delete_product(this.deleteID).subscribe((res: any) => {
console.log("helloooooo");
});
};
product.service.ts
delete_product(id) {
return this.http.delete("http://localhost:3000/delete_product/" + id);
}
бэкэнд
exports.deleteProduct = (req, res, next) => {
const id = req.param("id");
Product.deleteOne({ _id: id })
.then(() => {
console.log("deleted");
})
.catch(err => {
console.log(err);
});
};
Проблема: В приведенных выше кодах функция deleteProduct в product-operations.component.ts не работает должным образом. Точнее, это делает удаление. Но после выполнения деинсталляции подписка не запускается. Это предотвращает мое мгновенное обновление после удаления. Как я могу решить это?