AngularJS - Make synchronous http request
<p><strong>Angular Service</strong></p>

<pre><code>this.sendCommand = function (someData) {

                URL = myURL;
                return $http({
                    method: 'POST',
                    url: URL,
                    data: someData
                }).then(function (response) {
                    return response.data;
                }).catch(function (error) {
                    console.log(error)
                });
            };
</code></pre>

<p>Use Case: User can send multiple commands by clicking on a button. For example, request 2 should not return response until request 1 response is fulfilled. How do I make synchronous call using above snippet, so that even if user clicks on a button multiple times, the request being sent will be served in queue ?</p>