0

I use a variable

private $http:ng.IHttpService;

then i use a get call

this.$http({
                    url: url
                    skipAuthorization: true,
                    method: 'GET',
                    params:dataToBeSent
                })

The skipAuthorization flag is a flag used by angular-jwt, which causes it not to send the jwt.

I get the TypeScript error:

Error TS2345: Argument of type '{ url: string; skipAuthorization: boolean; method: string; params: { ..' is not assignable to parameter of type 'IRequestConfig'. Object literal may only specify known properties, and 'skipAuthorization' does not exist in type 'IRequestConfig'.

How can I fix this error?

1 Answer 1

3

This makes my TypeScript compiler happy:

let conf = {
    url: url,
    skipAuthorization: true,
    method: 'GET',
    params:dataToBeSent
} as IRequestConfig;

this.$http(conf);
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.