title: How to redirect a page based on condition in angularjs
body: <p>
  I want to redirect a page based on condition after logged in by user at that time "varView" flag will have some values using cookies or rootScope or any other option. After that, in config while doing routing i have to check the flag and based on flag's value page should get redirect.</p>
  
  <p>Here's code:</p>
  
  <pre><code>$routeProvider.when("/editTest/:testID",
  {
    templateUrl: '/apps/templates/xyz/editTest.html',
                 controller: 'EditTestController',
                 resolve: {
      load: function (ShareData, $location) {
      var varView = 'tabPanelView'; // this value of varView will get loaded from login
      if (varView == 'tabPanelView') {
        $location.path('/editTestPageView.html');
      } else {
        $location.path('/editTestTabPanelView.html');
      }
      return ShareData.get('cEditTest');
    }
  }
  });
  </code></pre>
  
  <p>If varView == 'tabPanelView' then redirect on editTestPageView.html page else redirect it to editTestTabPanelView.html.</p>
  
  <p>Actually, i have a customer form with two diff. views (2 html files) i.e. one with normal page scrollable with number of sections and other one is in Tab Panel view mode which is sections divided in tabs without scrollable. </p>
  
  <p>So, the page view settings is on user's hand in admin area. User will choose which form view he wanted and according to that the page should get open.</p>