unable to reload same state on page refresh
<p>I have created SPA with <em>angular v1.5.6</em> and <em>angular-ui-router v1.0.0alpha0</em>; Here is my <a href="https://plnkr.co/edit/AcQk0Zrik1RjgXL4qLSm?p=preview" rel="nofollow"><strong><code>Working Plunker</code></strong></a> .
in this SPA I have 3 page : landing page i.e. <strong>"/"</strong>, <strong>/Home</strong> and <strong>/About</strong> . Home page required login ; after login we save credentials in local Storage so that on refresh of page we do not lose the page. everything is working fine but now I have issue on <strong>/Home</strong> page </p>

<p>when I refresh the <strong>/Home</strong> page , it gives below error for the property which is defined in <em>data</em> attribute of <em>.state</em> and page do not load </p>

<blockquote>
  <p>angular.min.js:117 TypeError: Cannot read property <em>'authorizedRoles'</em> of undefined</p>
</blockquote>

<p>route is defined in below way ( only relevant code shown below)</p>

<pre><code> $stateProvider
        .state("home", {
            url: '/home',
            templateUrl: './home/home.html',
            controller: 'HomeController',
            requiresAuth: true,
            data : { pageTitle : 'Home', authorizedRoles: [USER_ROLES.admin, USER_ROLES.editor] }
        })
</code></pre>

<p>and using below code in <code>*.config*</code> which are the cause of error</p>

<pre><code>$transitionsProvider.onBefore({to: function(state) { return state.requiresAuth; } },
        function($transition$, $state, AuthService) {
            console.log(arguments);
            var from = $transition$.to().name;
            console.log(from);
            if(!AuthService.isAuthenticated()) {
                return $state.go("login", {referral : from});
            } else {
                console.log('I m logged in');
                var roles = $state.current.data.authorizedRoles;
                if(AuthService.isAuthorized(roles)) {
                    console.log('Authorized');
                }
            }
    });
</code></pre>

<p><em>note:</em> write any credentials in that plunker when asking for login.</p>

<p>after page refresh $state.current goes blank ; how to handle this situtaions?</p>