title: How to redirect in Angular if translate cookie is not set?
body: <p>I want to redirect the user to a language page and not allow him to the index page if he hasn't chosen a language yet. I'm using the <a href="https://angular-translate.github.io/" rel="nofollow">Angular Translate</a> module. This module has cookie usage built-in with the following function:</p>
  
  <pre><code>$translateProvider.useCookieStorage();
  </code></pre>
  
  <p>This works. Now I would like to know if this cookie is set, and if not, redirect the user to the language page. Here's my idea how to handle this.</p>
  
  <pre><code>.factory('cookiecheck', function(){
    if($translateProvider.CookieStorage.get) return true;
    return false;
  }
  
  
  .run(function($rootScope, $state){
  
  if(cookiecheck
              {$location.path('/language');}
      else
              {$location.path('/home');}
  </code></pre>
  
  <p>This doesn't work. How would I best approach this? What is the correct syntax to determine if a CookieStorage exists and redirect?</p>