title: Using an Angular factory for route resolves
body: <p>Using UI-Router, but I'm not sure that it matters.</p>
  
  <p>What I'm trying to do is extract away my current resolve logic into a factory/service, such that it doesn't pollute my <code>$stateProvider</code> definition. This is a short example:</p>
  
  <p>Here's my current config: (<code>$kinvey</code> is a service that returns a promise)</p>
  
  <pre><code>.state('home', {
    url: '/',
    views: {
      'header': headerView,
      'content': {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl',
      },
      'footer': footerView
    },
    resolve: {
      user: ['$kinvey', function ($kinvey) {
        return $kinvey.User.me();
      }]
    }
  })
  </code></pre>
  
  <p>And what I'd like it to be:</p>
  
  <pre><code>  resolve: {
      'user': 'DataResolverService.userResolve'
    }
  </code></pre>
  
  <p><strong>DataResolverService</strong></p>
  
  <pre><code>.factory('DataResolverService', function DataResolverService($kinvey) {
  
    var userResolve = {
      user: ['$kinvey', function ($kinvey) {
        return $kinvey.User.me();
      }]
    };
  
    // public API
    return {
      userResolve: userResolve
    };
  
  });
  </code></pre>
  
  <p>I seem to be getting a <code>Unknown provider: DataResolverService.userResolveProvider &lt;- DataResolverService.userResolve</code>. Is this because factories/services can't be run like this inside the <code>config()</code> block?</p>