$translate.use(lang) take the app to different state

Hello,

I’m developing a multilanguage app on ionic 1, when I change the app language on runtime, the app changes the language correctly, but it moves to another state. what cause this behavious? and how to prevent it?

here is piece of my code:

angular.module(‘starter’).controller(‘SettingsCtrl’,function($scope, $state, $translate) {

        $scope.changeCurrentLanguage = function(lang){

   
			localStorage.setItem("preferredLanguage", lang);
			 
           $translate.use(lang);
	
        }
        
   
});

Thanks

I found the problem, the problem was that the buttons I used to change the language is like this:

<div class="lang_holder" style="margin-top: 30px;">
        <a href="#" ng-click="changeCurrentLanguage('ar')" class="arButton">عربي</a>
        <a href="#" ng-click="changeCurrentLanguage('en')" class="enButton">Eng</a>
</div>

The link attribue href="#" was causing this issue, and it solved after removing it.