这是我的组件中的方法:
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);
});
}
}
Run Code Online (Sandbox Code Playgroud)
这是我服务中的方法:
public Deleteprod(url) {
return this.httpClient.delete(url);
}
Run Code Online (Sandbox Code Playgroud)
我想删除这个对象,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.
Run Code Online (Sandbox Code Playgroud)
rest spring-boot angular cross-origin-read-blocking angular8