AngularJS / UI Router - Locale in State URL / TemplateURL
<p>What I'm trying to accomplish is to set a <code>$scope</code> variable to the state parameters,</p>

<pre><code>  .state('form', {
        url: '/' + locale + '/form',
        templateUrl: locale + '/form.html',
        controller: 'formController'
    })
</code></pre>

<p>Currently I'm just using a variable </p>

<pre><code>var locale
</code></pre>

<p>However I want the URL's to dynamically change if the </p>

<pre><code>$scope.locale
</code></pre>

<p>changes. For example, if the user selects English, then the scope will change to</p>

<pre><code>$scope.locale = 'en';
</code></pre>

<p>I want this to also reflect in the states / URL, and bring the user to the appropriate language page. I guess I'm trying to do something like this:</p>

<pre><code>  .state('form', {
        url: '/' + $scope.locale + '/form',
        templateUrl: $scope.locale + '/form.html',
        controller: 'formController'
    })
</code></pre>

<p>Is there any way to live-update this <code>$scope</code> information in the <code>$stateParams</code>??</p>

<p>How can I accomplish a live change in both templateUrl as well as URL of the page?</p>