I have an Ionic app where it fetches the data from remote server and displays it on Ionic html page.
The remote URL is like this:
This will give me a JSON object of "content" and will be used further in the html page of Ionic app.
It is being used like this on html page inside Ionic app:
<div class="article-desc">
<p [innerHtml]="myObject?.Body"></p>
</div>
"myObject" is the JSON object of response received from the server.
The "Body" field contains the HTML to be displayed in the paragraph. This "HTML" field is being returned from server only along with the entire "content" object.
"Body" field can have content like this:
<p>blah blah <img src="http://foo.com/image/1"/> blah blah <img src="http://foo.com/image/2"/>blah blah blah </p>
You can see from the above example that the images are there in that html.
I have no issue rendering the html from that field to Ionic Page.
I have one issue here that my images are not being rendered there.
Here is why..
My app is locked for Guest users so for each request I need to send an Authorization header in order to authenticate it and in this case all the images are not able to render because each image request will be treated as guest here for server.
Can you suggest a common place where all my images and other sources like there in html should pass through and can send authorization header along with it to server.
I already have the Authorization Token in local storage item.
My goal is to send authorization header to each external source (image here) present in that Body field when it renders in Ionic app.