这是我的组件中的方法:
onDelete(s) {
const conf = confirm('etes vous sur');
if (conf) {
console.log(s._links.self.href);
this.catservice.Deleteprod(s._links.self.href).subscribe(data => {console.log(s._links.self.href);
}, error1 => {
console.log(error1);
});
}
}
这是我服务的方法:
public Deleteprod(url) {
return this.httpClient.delete(url);
}
我想删除这个对象,s._links.self.href
所以url
没有错,但是当我尝试websecurityconfig
用我尝试过的她的方法上课时遇到了这个问题,@CrossOrigin(origins = "*")
但没有解决方案,请帮助我。
这是我的错误:
Access to XMLHttpRequest at 'http://localhost:8080/offres/24' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.