title: Injecting $resource into controllers
body: <p>I'm trying to make a module that returns a $resource object and I want to inject that $resource object into my other controllers. Here's my code</p>
  
  <p>This is the module that returns a $resource ....</p>
  
  <pre><code>// module with resource
  var rest = angular.module('rest', ['ui.bootstrap','ngResource'])
  .factory('profileAPI', function($resource) {
  
      // get the user id
  $scope.userid = sessionStorage["cerestiuserid"];
  
  // json we get from server
  $scope.apicall = sessionStorage["cerestihome"];   
  
      return $resource($scope.apicall + "/api/userprofile/", {Userid:$scope.userid}, {'post':{method: 'POST'}});      
  });
  </code></pre>
  
  <p>And these are the controllers I want to inject it in ...</p>
  
  <pre><code>var profile = angular.module('profile', ['ui.bootstrap','ngResource', 'rest']);
  
  profile.controller("profileController", ["$scope", "$resource", 'rest', function($scope, $resource, rest) { 
  
  var route = angular.module('route', ["ui.router"])
  
  route.controller('editController', ["$scope", "$resource", 'rest', function($scope, $resource, infos) {
  </code></pre>
  
  <p>I'm injecting 'rest' into the controllers but it's giving me an error that says "Error: [$injector:unpr] <a href="http://errors.angularjs.org/1.2.8/" rel="nofollow noreferrer">http://errors.angularjs.org/1.2.8/</a>$injector/unpr?p0=restProvider%20%3C-%20rest
      at Error (native)". Any suggestions?</p>