title: AngularJS function DI parameter
body: <p>i'm building a provider for the authentication part of the app. I'm having trouble on passing values to a function when using dependency injector.</p>
  
  <pre><code>angular.module('security.authorization', ['security.service'])
  .provider('securityAuthorization', {
      requireRole: ['securityAuthorization', 'rolesAllowed', function(securityAuthorization, rolesAllowed) {
          return securityAuthorization.requireRole(rolesAllowed);
      }],
  
      $get: ['security', '$q', function(security, $q) {
          return {
              requireRole: function(rolesAllowed) {
                  console.log(rolesAllowed);
              }
          };
      }]
  });
  </code></pre>
  
  <p>I'm trying to call "requireRole" from app.config $routeProvider.</p>
  
  <pre><code>.when('/map', { controller: 'MapCtrl', templateUrl: 'partials/user/map.html',
          resolve: {
              authenticatedUser: securityAuthorizationProvider.requireRole('user')
          }
      })
  </code></pre>
  
  <p>But it gives me</p>
  
  <blockquote>
    <p>Uncaught Error: [$injector:modulerr] Failed to instantiate module
    myApp due to: TypeError: object is not a function</p>
  </blockquote>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>app.config(function($routeProvider, $httpProvider, securityAuthorization) {
      $routeProvider
      .when('/map', { controller: 'MapCtrl', templateUrl: 'partials/user/map.html',
          resolve: {
              authenticatedUser: ['securityAuthorization', function(){
                  return securityAuthorization.requireRole('user');
              }]
          }
      });
  }); 
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Error: [$injector:unpr] Unknown provider: securityAuthorization</p>
  </blockquote>