title: Conditionally navigate to state with angular ui-router
body: <p>Currently, we have a 'Portfolio' tool in beta. Once a user logs in to the main app, if they have been given access to the beta, they can navigate to the Portfolio tool directly, without any additional login. If not, they should be redirected to a Portfolio login page (state is called portfolio.login) where they can login or contact support/sales etc. Right now I have the check in the resolve block, however $state.go('portfolio.login') seems to fetch the right partials, but doesn't render them on screen or navigate to the appropriate URL. </p>
  
  <p>Code:</p>
  
  <pre><code>angular.module('portfolio.manager').config(function ($logProvider, $stateProvider) {
  'use strict';
  
      $stateProvider
      .state('portfolio.manager', {
          url: '/manager',
          resolve: {
              CheckLoggedIn: function ($state, loggedIn) {
                  var _loggedIn = loggedIn.checkUser();
                  if (!_loggedIn) {
                      $state.go('portfolio.login');
                      console.log('not authorized');
                  }
              },
              portfolioAuthService: 'portfolioAuthService',
  
              User: function(portfolioAuthService){
                return portfolioAuthService.getUser();
  
              },
              Portfolios: function (User, portfolioManagerService) {
                  return portfolioManagerService.getPortfolios();
              }
          },
          views: {
              'main@': {
                  templateUrl: 'app/portfolio/manager/portfolio-manager.html',
                  controller: 'PortfolioManagerCtrl'
              },
              'no-portfolios@portfolio.manager': {
                  templateUrl: 'app/portfolio/manager/partials/no-portfolios.html'
              },
              'create@portfolio.manager': {
                  templateUrl: 'app/portfolio/manager/partials/create.html'
              }
          }
      })
  </code></pre>