I have some images stored on my backend which are protected by authentication.
My application has a http interceptor set up to call my backend with a token once it's logged in.
I've tried the following code to load an image after the page has loaded but I'm hitting some issues:
html:
<img [src]='loadImage(example["File Name"])'/>
<figcaption>{{example['Caption']}}</figcaption>
ts:
loadImage(imgFileName)
{
console.log("Load Image");
let url = `${this.apiUrl}/images/${imgFileName}`;
console.log(url);
return this.httpClient.get(url);
}
Console output:
Network tab: