Here is my code
Product interface
export interface Product{
_id?:string,
name?:string,
price?:number;
quantity?:number;
tags?:Tags[];
files?: File[];
}
temp.component.ts->the function in component file to use service to send data
export interface Tags {
name: string;
}
constructor(private appService:AppService){
}
submit(){
this.product_decided = {
name: this.product.value.name,//string
price:this.product.value.price,//string
quantity:this.product.value.quantity,//string
tags:this.product.value.tags,//TAGS[]
files:this.files//FILES[]
}
this.appService.create_product(this.product_decided).subscribe();
}
Here is my AppService
export class AppService{
private userUrl = "http://localhost:5000/"
constructor(private http:HttpClient){}
create_product(product:Product){
return this.http.post<Product(this.userUrl,JSON.stringify(product);
}
}
Here is my product.console
Json stringify converts everything to string but my files are NULL.
Is there any way to upload this product_decided to using HTTP.