title: deferred.resolve giving error TypeError: undefined is not a function
body: <p>I am using angularjs and cordova tool for creating application.</p>
  
  <p>I have created service, which contains code for calling APIs. and in that I want to return response to my angular controller.</p>
  
  <p>My code is,
  Service,</p>
  
  <pre><code>JodoModule.factory('commonServices', function ($http, $q, $rootScope) {
      return {
          getServiceData: function (url) {
              $rootScope.loading = true;
              var deferred = $q.defer();
              var req = {
                  method: 'GET',
                  url: url
              }
  
              $http(req).success(function (data) {
                  alert("data in service = " + JSON.stringify(data.Data));
                  deferred.resolve(data);
              }).error(function (data, status, headers, config) {
                  deferred.reject(status);
              });
              return deferred.promise;
          }
      };
  });
  </code></pre>
  
  <p>My controller is,</p>
  
  <pre><code>commonServices.getServiceData("My url").
              success(function (data, status, headers, config) {
                  alert(data);
              }).
              error(function (data, status, headers, config) {
                  alert("Got error");
              });
  </code></pre>
  
  <p>In above code, in service, its showing elert message for JSON.stringify(data.Data)); in success block, so data is comming, but its not executing deferred.resolve(data); properly...</p>
  
  <p><strong>in Web tool bar its giving me error,</strong>
  <strong><code>ie. TypeError: undefined is not a function</code></strong></p>
  
  <p><strong>My o/p is :</strong> </p>
  
  <pre><code>{"status":"SUCCESS","Message":"success","Token":"","Data":[{"Id":17,"UserId":"477f1919-6b80-4804-a325-ac0cb05bcd3e","UserName":"honey","FirstName":"honey","LastName":null,"ProfilePic":false,"Status":2}]}
  </code></pre>
  
  <p>How can I solve this error. ? </p>