1

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 Answers 2

1

You could use APP_BASE_HREF in your application root module.

Sign up to request clarification or add additional context in comments.

1 Comment

This is what I was looking for, thank you! I just set this in the other HTML file: <base href="/my-application.html">
1

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!!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.