title: AngularJS - routeProvider resolve calling a service method
body: <p>I've created a service which checks the user login state (log the user in if token exists, otherwise redirect to login page).</p>
  
  <p>Originally I called this service through the routeProvider resolve - this works perfectly once, but since Angularjs services are singleton the test would not run for consecutive calls.</p>
  
  <p>I then tried to move the test into a method within the returned object, but I can't seem to be bale to get the routeProvider resolve to call a specific method of a service (which makes sense in a way).</p>
  
  <p>Question is, how do I make sure my test is executed each time the route is loaded?</p>
  
  <p>In the egghead videos series (<a href="http://www.egghead.io/video/rbqRJQZBF3Q">http://www.egghead.io/video/rbqRJQZBF3Q</a>) he uses a function assigned to the controller but this doesn't seem like the right solution for a production app (I don't want to assign a function to a specific controller and I do believe the Angularjs dependency injection won't work).</p>