1

So I have ui-router configuration like this :

$stateProvider

    .state('home', {
        url: '/',
        controller: 'MainCtrl as main'
    })

    .state('about', {
        url: '/about',
        templateUrl: 'app/views/about.html',
        controller: 'AboutCtrl as about'
    })

    ;

And Angular-translate switch language buttons like this:

<button class="langChoice" ng click="changeLanguage('ua')">ua</button>
<button class="langChoice" ng-click="changeLanguage('pl')">pl</button>

Controller to handle switching:

$scope.changeLanguage = function (langKey) {
    $translate.use(langKey);
};

So my question is how can I switch language and in the same time add prefix to my urls something like this "mysite.com/#/ua" or "mysite.com/#/ua/about" automatically once I click on switch language buttons?

P.S. language switching is working, the problem is with urls

lomboboo
  • 1,221
  • 1
  • 12
  • 27

0 Answers0