0

I would like to make a synchronous call to server using angular. Something similar to below jquery functionality.

var response = $.ajax(
        {
            type: "POST",
            url: "url",
            data: "data",
            async: false,
        }).responseText;

Thanks

0

1 Answer 1

0

Angular doesn't have any functions included which are synchronous. You'll have to write something custom with XHR or you'll have to just use a promise. Any reason why you can't use a promise? Angular does have a service called $q which can help you with promises. The default $http service returns a promise.

Sign up to request clarification or add additional context in comments.

1 Comment

Can you please share some links how to use $q or share some code. I tried some but i couldn't able to do that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.