Reputation: 115
I have an angular project with html's/CSS/component(.ts files)/service(.ts files). service methods are reading data from .json files in the assets folder(not calling backend).
I am doing a prod build which will generate html's/CSS/javascript files in dist folder.
The problem is generated index.html file is not rendering, displaying blank screen in browser without server(application server). My requirement is to make this HTML work offline.
how can I export standalone html's/CSS/javascripts to work as a offline html from angular project?
Generated dist folder structure:
Upvotes: 3
Views: 933
Reputation: 388
You can do that using http-server package.
First install the package globally
npm install http-server -g
Then inside your project directory(in the terminal) just run
http-server dist/
And if you are using Angular 6+ or above (Working with Angular 10), You have to run
http-server dist/your-project-name
Now you can visit http://localhost:8080 to view your application
Upvotes: 1