Loading

Angular - Static Page setup

Angular - Static Page setup

In this post, I am going to show you, how to access the static page in angular project.

Since we know that to access the angular component we need to define that component in angular routing path then we will able to access. But if you have some static Html pages (privacy.html,about-us.html) that you want to access in your angular project then it will not possible to access through routing. So let's start how to access these static pages in angular

First copy all your static pages under /app/src/ folder

Next, open the angular.json file and search assets you will find the similar code as below. If you are modifying the assets array the first time.


   "assets": [
    "src/favicon.ico",
    "src/assets"
]

You may like: How to use Local Storage

Now add all your static pages inside the assets array. I am adding my privacy.html & about-us.html page.


 "assets": [
    "src/favicon.ico",
    "src/assets",
    "src/privacy.html",
    "src/about-us.html"
]

Now build your angular project and deploy to access these 2 HTML pages or for dev testing run ng serve command and type http://localhost:4200/privacy.html to access these static pages.

That's it. Thanks for reading.

You may like: Angular – Recenter Angular Google Maps ( AGM )

Related Articles