Our main app currently offers a 'Portfolio' tool in beta testing. Users who have access to the beta can easily navigate to the Portfolio tool without needing an additional login upon logging into the main app. For those who do not have beta access, they will be directed to a Portfolio login page (referred to as portfolio.login) where they can log in or reach out to support/sales for assistance. At the moment, I have included a check in the resolve block, however, while $state.go('portfolio.login') seems to fetch the correct partials, it does not render them on the screen or take the user to the appropriate URL.
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'
},
'<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="94fafbb9e4fbe6e0f2fbf8fdfbe7d4e4fbe6e0f2fbf8fdfbbaf9f5faf5f3f1e6">[email protected]</a>': {
templateUrl: 'app/portfolio/manager/partials/no-portfolios.html'
},
'<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aecddccbcfdacbeedec1dcdac8c1c2c7c180c3cfc0cfc9cbdc">[email protected]</a>': {
templateUrl: 'app/portfolio/manager/partials/create.html'
}
}
})