title: Access scope or service in ui router onEnter to check access (auth)
body: <p>Ok, so I have a state for the url "/securepage" which I need to check whenever a user tries to access it. So I read there is an onEnter function I can use. But I cannot seem to get hold on the scope nor a service from there. What am I doing wrong?</p>
  
  <pre><code>        .state('securepage', {
              url: "/securepage",
              template: securepage.html,
              onEnter: function(){
                  // if (!$scope.main.isAuthenticated) $state.go("/login");
                  // if (!myLoginService.currentUser()) $state.go("/login");
  </code></pre>
  
  <p>Current options as I see it are to use resolve and/or check the authentication in the controller. But wouldnt an auth check be better placed in onEnter?</p>