Jerome P Mrozak
Jerome P Mrozak

Reputation: 1957

Angular 2 URL navigation not working?

Again, I'm starting with one of the provided Angular 2 tutorial projects. Running it stock, I can navigate around using the programmed buttons and interactive controls.

OK, lets play with the URL bar. I can type in MYSITE:8000/crisis-center/heroes and sometimes see the Heroes component, which should be available only thru /heroes. Later the browser complains it can't find MYSITE:8000/crisis-center/app/main.ts. At this point the program has gone insane.

In Angular 2 can I expect the programmed components and URL bar to be equivalent? If I directly jump to something like http://localhost:8000/crisis-center;id=1;foo=foo/1 can I expect it to work? Or is there a config/programming trick?

Thanks, Jerome.

Upvotes: 0

Views: 433

Answers (1)

penleychan
penleychan

Reputation: 5470

Make sure you have <base href="/"> somewhere in your index.html head.

If that's not the issue, then it may be related to your web server settings, for example if you are using local IIS to host your angular localhost:8000, you need to url rewrite rules on your web.config.

Upvotes: 0

Related Questions