Angular4: How to create an XML file and return it to the browser

Forgive me because I'm relatively new to Angular 4, but I'm stuck ...

I would like the user to go to https://example.com/sitemap in his web browser ...

  • Data is requested from Firebase
  • XML structure built from this data
  • (THIS MAY NOT BE FIGURE) XML is returned to the user’s web browser with the application content type / xml (i.e. <head> , <body> , <script> and other contents of my src / index.html, should not be included in the response )

I did a lot of Googling and searching, but all I find is just to swallow the XML document or write the XML to the page, but not write the XML document back to the web browser.

Working examples would be appreciated since I am still learning everything outside of Angular 4.

+8
angular firebase
source share
1 answer

Since no one could offer an answer, I created my pretty hacky answer. Since I use Firebase for hosting, I used the Firebase storage API to save the sitemap.xml file, and then translate the browser into the newly generated document.

0
source share

All Articles