title: The easiest way to check if localStorage has a value in AngularJS routing
body: <p>Many tutorials in web have a little bit strange and huge logic of angularJS conditional routings...</p>
  
  <p>i need something very simple:</p>
  
  <p>just one component to check, if localStorage has authFlag as true, then something like:</p>
  
  <pre><code>app.config(function ($routeProvider) {
    $routeProvider
        .when('/', {
            templateUrl: 'views/app.html',
            controller: 'AppCtrl'
        })
        .when('/articles', {
            templateUrl: 'views/articles.html',
            controller: 'ArticlesCtrl',
            conditions: { isAuth }
        })
        .otherwise({
            redirectTo: '/'
        });
  });
  </code></pre>
  
  <p>how is it better to do? to check if authFlag is in localStorage, if not, then root to '/' ?</p>