'Angular not showing static HTML file that is declared in assets
I would like to show a static HTML file as part of the Angular app, so included it in assets
section in angular.json
file. But still when accessing it http://localhost:4200/msal2.html via the browser, the angular routing tries to resolve it and shows the "Error: Cannot match any routes. URL Segment..".
I am using Angular v12 on windows.
If I access that static html page as http://localhost:4200/assets/msal2.html, then the response is the html content present in the index.html
in the angular app, not the content of my static html file.
I have referred similar questions in SO, but not finding relevant solutions. Q1, Q2.
What am I missing? is it only possible by creating
a component
that can show this static html content, as shown in this SO answer?
The below is the assets
section in the angular.json file,
"assets": [
"src/favicon.ico",
"src/assets",
"src/static/msal2.html"
],
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|