title: angular js - update $stateParams on angular material switch change event
body: <p>I want to know if is a way of updating a <code>$stateParams</code> parameter after a change event of an <code>angular material switch</code></p>
  
  <pre><code>&lt;section id="app_controls"&gt;
      &lt;span style="margin-right: 10px;"&gt;Ro&lt;/span&gt;
      &lt;md-switch  class="md-primary" 
                 ng-model = "data.lang"
                 aria-label="Switch language" 
                 ng-true-value="'en'" 
                 ng-false-value="'ro'"
                 ng-change="setLang(data.lang)"
      &gt;En&lt;/md-switch&gt;
      &lt;span id="exit"&gt;&lt;/span&gt;
  &lt;/div&gt;  
  &lt;/section&gt;
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>.controller('homeController', ['$stateParams','$state', '$scope', 'PageProperties', 'loadMyData',
              function($stateParams, $state, $scope, PageProperties, loadMyData){     
  
  
      //set page elements 
      var properties = PageProperties.setProps("home", loadMyData);
      $scope.props = properties;
      $scope.lang;
  
      $scope.setLang = function(lang) {           
          $scope.message = lang;
        };
  }])
  </code></pre>
  
  <p><strong>route.js</strong></p>
  
  <pre><code>.state('home', {
              url: '/home?lang',
              params: { lang: 'ro'},
              templateUrl: 'views/home/home.html',
              controller: 'homeController',//'homeController'
              resolve:{
                      //loadResources e doar o denumire, nu vreun key-word
                        loadResources: ['$ocLazyLoad', function($ocLazyLoad) {
                            // you can lazy load files for an existing module
                            //conteaza ordinea in care le scriu
                                   return $ocLazyLoad.load(['pageNavPropsService', 'homeCtrl','homeDirective']);
                         }],
                         loadMyData: ['$stateParams', 'GetDataService', function($stateParams, GetDataService){
                             //get innitial data for states
                             var path = '_global/views/services/json/' + $stateParams.lang + '_data.json';
                             return  GetDataService.getData(path);
                         }]
              }
          })      
  </code></pre>
  
  <p>I cannot access annything else from the controller except <code>$scope</code> inside of <code>setLang()</code> function.</p>
  
  <p>What I'm trying to achieve is to have a language switch wich will update the state parameter <code>lang</code> - which I hope it will remain the same for anny other state on state change. Also I want to reload this state after the parameter has changed.</p>
  
  <p>How can I achieve that?</p>