I have an AngularJS web app. When a user gets to my domain root URL root-domain/ my app checks automatically his navigator language and if different than english it should automatically include the language in the url, like root-domain/es. This makes my controller reloads and I would like to avoid this for performance and user experience purposes.
I have read the solution provided Can you change a path without reloading the controller in AngularJS? by @Vigrond but for some reason I get next error:
TypeError: $rootScope.$on is not a function
at LocationUrl.$location.path (app.js:140)
at Constructor.HomeCtrl (home.js:15)
in line: var un = $rootScope.$on('$locationChangeSuccess', function () {
According to the approach, you don´t have to do anything else, but I guess I´m missing something.