I'm starting a new project using boilerplate MEAN provided by MEAN.JS (not .IO).
I'm new to ui-router and I'm having trouble figuring out how to accomplish this scenario:
- if user is logged in, go to state "home.loggedIn".
- if user is logged out, go to state "home.loggedOut"
- the route url is "/" and shouldn't change.
here's how the route provider looks like currently:
angular.module('core').config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { // Redirect to home view when route not found $urlRouterProvider.otherwise('/'); // Home state routing $stateProvider. state('home', { url: '/', abstract: true }). state('home.loggedOut', { templateUrl: 'modules/core/views/home.client.view.html' }). state('home.loggedIn', { templateUrl: 'modules/core/views/dashboard.client.view.html' }); } ]); I'm looking for something like a pre-save hook in db terms to determine which state to go to. How would that look like?