Q: AngularJS - Make synchronous http request Angular Service
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)
                });
            };

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 ?

A: I think it could be handled better with a boolean variable. As javascript is single threaded you could just create a variable 'isWaitingForResponse' and add an if to send the request only if there is no other in progress.
this.sendCommand = function (someData) {
    if (!this.isWaitingForResponse) {
        this.isWaitingForResponse = true; 
        // do request
        .then(
            this.isWaitingForResponse = false;
        );
    } else {
        // don't send request
    }
};

If you really want to queue the requests you could use a javascript: queue stackoverflow queue question. Then your code would look like this:
this.sendCommand = function (someData) {
    if (!this.isWaitingForResponse) {
        this.isWaitingForResponse = true; 
        // do request
        .then(
            this.isWaitingForResponse = false;
            // check if there is a request in a queue
            // if there is: invoke this.sendCommand
        );
    } else {
        // don't send request
        // put request in a queue
    }
};


A: You can use a spinner to block user clicking the button before the previous request is completed.
