Angular4: How do I generate an XML file and return it to the browser
angular, firebase
Solution
As nobody could seem to offer an answer, I created my rather own hacky answer. As I am using Firebase for hosting, I leveraged Firebase Storage API to save off my sitemap.xml file and then forward the browser to the just generated document.
Problem
Forgive me, for I am relatively new to Angular 4, but I am stuck on something... I would like when a user goes to https://example.com/sitemap in their web browser... - Data is queried from Firebase - An XML structure is built from this data - (THIS IS THE ONE I CAN NOT FIGURE OUT) XML is returned to the user's web browser with a content type of application/xml (i.e. the `<head>`, `<body>`, `<script>` and other contents of my src/index.html, should not be included in the response). I have done plenty of Googling and searching Stack Overflow -- but everything I find is just about ingesting an XML document, or writing XML to a page, but not writing an XML document back to the web browser. Working examples would be appreciated, as I am still learning all the in's and out's of Angular 4.