Skip to content

Instantly share code, notes, and snippets.

@aj-dev
Last active October 12, 2016 14:57
Show Gist options
  • Save aj-dev/8d591f176ca0797be0b15529560a3abc to your computer and use it in GitHub Desktop.
Save aj-dev/8d591f176ca0797be0b15529560a3abc to your computer and use it in GitHub Desktop.
`anon.landing` state configuration
(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