The $stateChangeStart or $locationChangeSuccess events are triggered when navigating between site pages. And I would like to catch the event when the user first visits the site and find out the URL. Those. if the user enters into the address bar http://site.ru/user/info , and he does not have access to this directory, then you need to redirect him to the login page. thank

    1 answer 1

    Until I asked the question I did not think of it))). TypeScript Angular 2 Code:

     constructor(private $location: ng.ILocationService) { console.log($location.url()); // /user/info }