Angular2 - change location without starting a route

I have a view that uses a service to load a list of items. I always show only one element, moving between elements with <→.

Is there a way to change the address in the address bar of the browser and add an entry to the browser history without starting the Angular routing system?

I know that if I use:

location.go('users/3');

he will perform the above actions, but also launches the Angular route system, which, in turn, calls my services again.

Edit:

Location function seems to be

location.replaceState('users/3');

comes close to what I want to do - it changes the URL in the browser without starting any internal Angular elements, unfortunately, it replaces the last place in the history, and does not click the new one at the top.

+3
1

provider:, . bootstrap(AppComponent, [MyGlobalService]).

CanReuse . Angular 2: .

+1

Source: https://habr.com/ru/post/1666958/


All Articles