title: AngularJs: $http Synchronous call
body: <p>I have a service to for API call as following,</p>
  
  <pre><code>    getValue: function(input) {
          var deferred, url;
          deferred = $q.defer();
          url = "url";
          $http.post(url, input).success(function(data, status, headers, config) {
            return deferred.resolve({
              success: true,
              data: data,
              status: status,
              headers: headers,
              config: config
            });
          }).error(function(data, status, headers, config) {
            return deferred.resolve({
              success: false,
              data: data,
              status: status,
              headers: headers,
              config: config
            });
          });
          return deferred.promise;
        }
  </code></pre>
  
  <p>But this is async. How can I convert it to sync(I want to make it wait till I get the result)?</p>