Keep valid Angular2 routes(URL)

Asked

Viewed 409 times

1

I am starting the studies at Angular 2 and found a possible limitation that does not seem interesting for my application use case, because it seems to me it is not possible to reconstruct the state of the page through the route URL.

The example I will cite is the presentation in "CASE STUDY: TOUR OF HEROES", from the angular2 documentation.

In this example if you go to the "Full screen" option (to access the URL):

inserir a descrição da imagem aqui

You will notice that the default URL will be /dashboard and if you give F5, reload the page or copy the url to a new tab, the url will not be valid, as if you copy to your browser and remove the /dashboard the page will be loaded correctly.

I would like to know if you have any configuration or any way to keep these wheels valid so that they can be copied and sent to other people?

  • Have you ever tested on any of your work? Or just through their demo? Because I created a basic app for testing and with me everything worked perfectly, including with URL parameters. If the problem persists, it may be some server configuration, as is the case with Angular 1.x where we need to use server settings to enable the use of friendly URL’s.

  • @Celsomtrindade, yes I’m building a real application, and that’s where I noticed the problem. And I went to observe if in the examples of the documentation this problem also existed, as there was the problem in the official examples I resolved to cite them to be easier the understanding and verification of the problem.

  • That’s weird.. What kind of server are you using?

  • @Celsomtrindade, IIS Express for development. But its routes remain valid when applying refresh to the page?

  • Yeah, I just tested it for now on local Apache and when I reload the pages, no matter what route I’m on, it reloads normally. It was something that caught my attention, because in Angular 1.x it is necessary a lot of configuration to enable this function with friendly URL (without #)

  • @Celsomtrindade, Very strange indeed, because the example that I cited from the documentation this behavior does not happen. Can you analyze shallow by comparing to the example of documentation if there are any different angular 2 route settings? For mine are a mirror to the routes of documentation.

  • I don’t have my files at work, coming home I take a look and warn you, ok?

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.