I have developed an app with ASP.net core 6 and angular 13, my problem is in the link for file download for the API, it throws error in frontend code. code service in angular:
private baseUrl='https://localhost:7125/api';
getFilePath(url:string){
return `${this.baseUrl}/${url}`;
}
code TS File:
public setFile(): void {
//this.AllDemande.fileUrl : url link form database
if(this.AllDemande.fileUrl=!null){
this.DisplayFileUrl= this.congeService.getFilePath(this.AllDemande.fileUrl);
}
else{
this.DisplayFileUrl='assets/pdf.png';
}
}
in capture screeen when i want to take link of file pdf it dispaly link from angular server not from api
CodePudding user response:
change
if(this.AllDemande.fileUrl=!null){
to this:
if(this.AllDemande.fileUrl!=null){
CodePudding user response:
the problem you can see link of pdf it dispaly server of front-end and with i change it manuly in browser it work