1

I am trying to make a POST request that has a header and parameters. This is currently what my code looks like:

var login = Restangular.one('authentication/location',{Authorization:
    'token'}).post({grant_type:'password', username:'[email protected]',password:
    'password',scope:'my_scope'});

How do I correctly add my header and parameters using this style?

1 Answer 1

1

The signature for the element post() method is:

post(subElement, elementToPost, [queryParams, headers])

https://github.com/mgonto/restangular#element-methods

Headers in Restangular are set like this:

{'header name': 'header value'}

The subElement should be a collection, see this question for reference: Restangular POST always empty

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.