routes.js

angular.module('homepage').
run(function($rootScope, $state, $timeout, Authentication) {
    $rootScope.isVisible = {
        loading: false
    };
    $rootScope.currentRoute = {
        name: ''
    };
    $rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams) {
        $rootScope.isVisible.loading = true;
        if (toState.name == 'login' && Authentication.isAuthenticated()) {
            // User is authenticated
            $rootScope.currentRoute.name = "inputbasic";
            $state.transitionTo("inputbasic");
            event.preventDefault();
        }
        else if (toState.authenticate && !Authentication.isAuthenticated()) {
            // User isn’t authenticated
            $rootScope.currentRoute.name = "login";
            $state.transitionTo("login");
            event.preventDefault();
        }
        else if (!toState.authenticate) {
            $rootScope.currentRoute.name = toState.name;
        }
    });
    $rootScope.$on("$viewContentLoaded", function () {
        $timeout(function () {
            $rootScope.isVisible.loading = false;
        }, 1000);
    });
}).
config(function($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise('/start');
    $stateProvider.
        // INDEX STATES  ========================================
        state('start', {
            url: '/start',
            templateUrl: '../../html/partials/partial-index.html',
            authenticate: false
        }).
        // LOGIN ROUTES  ========================================
        state('login', {
            url: '/login',
            templateUrl: '../../html/partials/partial-login.html',
            authenticate: false
        }).
        state('signup', {
            url: '/signup',
            templateUrl: '../../html/partials/partial-signup.html',
            authenticate: false
        }).
        state('register', {
            url: '/register',
            templateUrl: '../../html/partials/partial-register.html',
            authenticate: false
        }).
        // FEATURE ROUTES  ========================================
        state('inputbasic', {
            url: '/input/basic',
            templateUrl: '../../html/partials/partial-input-basic.html',
            authenticate: true,
            controller: 'InputBasicController'
        }).
        state('inputexperience', {
            url: '/input/experience',
            templateUrl: '../../html/partials/partial-input-experience.html',
            authenticate: true,
            controller: 'InputExperienceController'
        }).
        state('inputextras', {
            url: '/input/extras',
            templateUrl: '../../html/partials/partial-input-extras.html',
            authenticate: true,
            controller: 'InputExtrasController'
        }).
        state('download', {
            url: '/download',
            templateUrl: '../../html/partials/partial-download.html',
            authenticate: true,
            controller: 'DownloadController'
        }).
        state('print', {
            url: '/print',
            templateUrl: '../../html/partials/partial-print.html',
            authenticate: true,
            controller: 'PrintController'
        });
});