T
T
timofy2018-02-16 22:56:23
Angular
timofy, 2018-02-16 22:56:23

Routing in AngularJs and #!?

I am writing an application in AngularJs. I made routing in the application, I made it so that the characters #! were not displayed in the address bar. But: if I write localhost:9000/#!/catalog in the address bar, then the application follows the /catalog route. But if you write localhost:9000/catalog , then the route does not go through and the page displays: "Cannot GET: /catalog". Moreover, by such a link: or using a javascript code: - by these methods, the transition along the route occurs. The problem is in the transition through the address bar, that is, it is impossible to go to the address localhost:9000/catalog, you need to write: localhost:9000/#!/catalog Who knows how to fix it?
<a href="/catalog">
$location.path("/catalog");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Tsvetkov, 2018-02-16
@timofy

on the server side, make a return on all urls of the same file, as for the main page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question