I am facing an issue with my service: Type Observable 'Object' is not assignable to type Observable 'Product'. Do you have any suggestions on how to resolve this problem? Here is a snippet of my code:
export class Product{
public id:number;
public price:number;
}
This is from my TypeScript file:
onSaveProduct(data: any) {
this.catService.saveResource(this.catService.host+"/produits",data)
.subscribe(res=>{
this.currentProduct=res
},err=>{
console.log(err)
})
}
This is part of my service:
public saveResource(url,data):Observable<Product>{
return this.httpClient.post(url,data);
}