1
votes

I'm working on an Angular2 app and have a requirement to not bootstrap the application on index.html. Given that NG2 uses the HTML5 routing features, this doesn't work too well if you are not using index.html as your bootstrap. (Especially if you refresh the page)

  1. What is the preferred way to bootstrap an NG2 application, not on index.html?

  2. How do you preserve the url/routing so that a page refresh works? (again, not on index.html)

2

2 Answers

1
votes

You could use APP_BASE_HREF in your application root module.

1
votes

you can totally serve Angular on any HTML page, Route persistence depends on your server technology.

If you are using angular-cli, you can configure index file in .angular-cli.json file

"index": "myhomepage.html"

Whenever a route is called it goes to server to look up the Files, If your Server is configured to correctly Route they can be persisted.

Hope this helps!!