title: $state resolve with parameter - AngularJS $StateProvider
body: <p>I'm trying to add a <code>resolve</code> to my <code>$state</code> in my routing following this guide <a href="http://www.dwmkerr.com/promises-in-angularjs-the-definitive-guide/#advancedpromisesrouting" rel="nofollow">here</a>.</p>
  
  <p>Going a bit further than the guide by adding parameters to the function things stop working.</p>
  
  <p>my code looks like this</p>
  
  <pre><code>'use strict';
  
  angular.module('academiaUnitateApp')
    .config(function ($stateProvider, entryService) {
      var getEntry = function(id) {
          entryService.find(id)
              .then(function(response){
                  return response.data;
              })
              .catch(function(error){
                  return null;
              });
      };
  
      $stateProvider
          .state('entry', {
              url: '/entry/:id',
              templateUrl: 'app/entry/entry.html',
              controller: 'EntryCtrl',
              resolve: {
                  entry: getEntry($state.current.param.id)
              }
          });
    });
  </code></pre>
  
  <p>however my console log looks like this:</p>
  
  <pre><code>Uncaught Error: [$injector:modulerr] Failed to instantiate module academiaUnitateApp due to: //didn't add this part tell me if needed
  Error: [$injector:unpr] Unknown provider: entryService
  </code></pre>
  
  <p>So from what I can greater is that the entryService provider isn't known, if this is correct how should I add this, instead of the way I'm adding it at the moment.</p>
  
  <p><br/>
  <hr/>
  <br/></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is the entryService</p>
  
  <pre><code>'use strict';
  
  angular.module('academiaUnitateApp')
      .factory('entryService',function($http, $state){
          var service = {};
  
          service.find = function(_id){   
              return $http.get('/api/entrys/' + _id);
          };
  
          return service;
    });
  </code></pre>
  
  <p><br/></p>
  
  <p>app/app.js</p>
  
  <pre><code>'use strict';
  
  angular.module('academiaUnitateApp', [
      'ngCookies',
      'ngResource',
      'ngSanitize',
      'btford.socket-io',
      'ui.router',
      'ui.bootstrap',
      'textAngular'
  ])
    .config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
      $urlRouterProvider
        .otherwise('/');
  
      $locationProvider.html5Mode(true);
      $httpProvider.interceptors.push('authInterceptor');
    })
  
    .factory('authInterceptor', function ($rootScope, $q, $cookieStore, $location) {
      return {
        // Add authorization token to headers
        request: function (config) {
          config.headers = config.headers || {};
          if ($cookieStore.get('token')) {
            config.headers.Authorization = 'Bearer ' + $cookieStore.get('token');
          }
          return config;
        },
  
        // Intercept 401s and redirect you to login
        responseError: function(response) {
          if(response.status === 401) {
            $location.path('/login');
            // remove any stale tokens
            $cookieStore.remove('token');
            return $q.reject(response);
          }
          else {
            return $q.reject(response);
          }
        }
      };
    })
  
    .run(function ($rootScope, $location, Auth) {
      // Redirect to login if route requires auth and you're not logged in
      $rootScope.$on('$stateChangeStart', function (event, next) {
        Auth.isLoggedInAsync(function(loggedIn) {
          if (next.authenticate &amp;&amp; !loggedIn) {
            $location.path('/login');
          }
        });
      });
    });
  </code></pre>