angular - Angular 服务删除方法
问题描述
我正在尝试使用角度服务delete
方法删除客户,但我不知道如何id
从角度组件动态传递参数。谁能告诉我如何id
动态传递?
deleteCustomerById(id: number): Observable<number>
{
const httpOptions =
{
headers: new HttpHeaders({ 'Content-Type': 'application/json'})
};
return this.http.delete<number>('http://localhost:58274/api/Customers/{id}' + id, httpOptions);
}
解决方案
推荐阅读
- spring-boot - 每个 url 模式的身份验证提供程序 - Spring Boot
- vue.js - 即使我有错误Vuejs,提交表单后模态也会关闭
- java - TaskStackBuilder 与正常的 startActivity 一次又一次
- .htaccess - 当文件存在时,Htaccess + mod_rewrite 不起作用
- python - 在 Python 中使用 tkinter 更改字符输出的宽度
- java - 如何将注释值发送到 @Before 方法?
- angular - 打字稿:将字符串 [] 映射到 [字符串,字符串]
- python - Python NumPy 数组和矩阵乘法
- javascript - ChartJs 饼图图例位置
- flutter - 当主题或正文为中文时,iOS 中的 URL 启动器异常