title: Is there a way I can return a promise from a $resource without needing to use $q?
body: <p>I have coded the following service:</p>
  
  <pre><code>angular.module('App')
      .factory('TestService', ['$http', '$q', '$resource', function (
                            $http, $q, $resource) {
  
          var TestResource = $resource('/api/Tests', {}, {
              saveData: { method: 'PUT' },
              deleteData: { method: "DELETE", params: { TestId: 0 } }
          });
  
          var factory = {
  
              query: function (selectedSubject) {
                  var deferred = $q.defer();
                  TestResource.query({ subjectId: selectedSubject },
                     function (resp) {
                         deferred.resolve(resp);
                     }
                  );
                  return deferred.promise;
  
                  //return Test.query({ subjectId: selectedSubject });
              }
  
          }
          return factory;
  }]);
  </code></pre>
  
  <p>In my controller I am calling it this way:</p>
  
  <pre><code>TestService.query($scope.selectedSubject)
                          .then(function (result) {
                              $scope.gridData = result;
                          }, function (result) {
                              alert("Error: No data returned");
                          });
  </code></pre>
  
  <p>Is there a way that I could cut out a few lines of code by not having $q in my service. Is there a way that I could return a promise from the $resource? I have tried the commented out code but that gives me an error saying there is no ".then" method.</p>