title: AngularJS $promise is undefined
body: <p>I am trying to make an ajax call using $resource and load a datatable upon receiving the data from a server. But when I call a get() then I am getting $promise as undefined.
  I am using a factory to make the call.
  Here is my factory :</p>
  
  <pre><code>    app.factory('getAllUsers', [ '$resource', function($resource) {
  return $resource('URL', {}, {get : {method : 'GET'}});
  }]);
  </code></pre>
  
  <p>And the controller :</p>
  
  <pre><code>      app.controller('MyController',function($scope,$location,getAllUsers){
  
          console.log("In controller");
  
          getAllUsers.get().$promise.then(function(data) {
  
              loadDatatable(data);
              });
  
  
       });
  </code></pre>
  
  <p>ERROR : getAllUsers.get().$promise is undefined</p>
  
  <p>NOTE : I have included ngResource in my app and angular-resource.js in index.html too.</p>