Answer the question
In order to leave comments, you need to log in
What are the best practices for working with angular-ui-router?
I'm familiar with angular, and it seems to me that working with native ngRoute is not as fun as working with third-party angulalr-ui-router. The concept of states is much more interesting than URLs.
Along the way, a whole bunch of questions arise:
1) html5Mode - to use or not?
2) the "Forward" and "Back" buttons in the browser history sometimes do not work, and it's not entirely clear what exactly I'm breaking in the code
3) How to get into a specific state immediately by writing it in the browser's address bar? In html5Mode mode, I bind the state to URLs, but when I go through this path, I get 404. Which is logical in principle, the server does not know what paths the states have.
4) how is it now ideologically correct to issue a custom 404 page? take it as a client if the address is not in the states or give it to the server?
5) is it normal if I don't want to assign my own URLs to some states? Or is the patient not all right with his head?
6) if I want to test my client, how do I walk through the states programmatically if the states have no paths?
Throw advice or links, the docks are not clear, thanks.
Answer the question
In order to leave comments, you need to log in
1) Depends on the case. If you use it, you need to route routes to the input controller. I find it easier through hashbang.
2) Never met. If the application loaded without errors, all templates / controllers are in place - it should be fine
3)
$stateProvider.state({name: 'foo', url: '/foo', template: 'foo'});
<!-- ссылка в разметке -->
<a data-ui-sref="foo">foo</a>
// Переход из контроллеров/сервисов итд
$state.go('foo')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question