title: How can I make this function minification safe?
body: <p>I get that this is pretty much the convention to make a controller minification safe</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('myApp', [])
  .controller('MyController', ['myService', function (myService) {
    // Do something with myService
  }]);</code></pre>
  </div>
  </div>
  </p>
  
  <p>But my issue is that i have a function within the controller that is breaking the app. This below is the function</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function redirectWhenLoggedOut($q, $injector) {
                  return {
                      responseError: function (rejection) {
  
                          var $state = $injector.get('$state');
                          var rejectionReasons =      ['token_not_provided', 'token_expired',
                              'token_absent', 'token_invalid'
                          ];
                          angular.forEach(rejectionReasons, function (value, key) {
  
                              if (rejection.data.error === value) {
  
                                 
                                  localStorage.removeItem('user');
  
                                  
                                  $state.go('main.login');
                              }
                          });
  
                          return $q.reject(rejection);
                      }
  
                  }
  
  
              }</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do i refactor it in a way that will make it minification proof as well?</p>