Last active
October 12, 2016 14:57
-
-
Save aj-dev/8d591f176ca0797be0b15529560a3abc to your computer and use it in GitHub Desktop.
`anon.landing` state configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
angular.module('evbox.landing') | |
.config(stateConfig); | |
stateConfig.$inject = ['$stateProvider']; | |
function stateConfig($stateProvider) { | |
$stateProvider.state('anon.landing', { | |
url: '', | |
abstract: true, | |
resolve: { | |
tenantLanguages: ['languageService', function (languageService) { | |
return languageService.getTenantLanguages(); | |
}], | |
user: ['$log', '$state', 'sessionService', function ($log, $state, sessionService) { | |
return sessionService.getUserPromise() | |
.then(function onFulfilled() { | |
// If user is already logged in, redirect to home page | |
$state.go('user.home', null, {location: 'replace'}); | |
}) | |
.catch(function onRejected(error) { | |
$log.debug('Routing error', error); | |
}); | |
}] | |
}, | |
views: { | |
'main@anon': { | |
templateUrl: 'modules/landing/landing.html' | |
} | |
} | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment