2016-01-25 68 views
0

我使用可變誤差與角JWT和打字稿

private $http:ng.IHttpService;

然後我使用得到調用

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

的skipAuthorization標誌是由角JWT中使用的標誌,這會導致它不發送jwt。

我得到的打字稿錯誤:

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'.

如何解決這個問題?

回答

2

這使我的打字稿編譯器高興:

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

this.$http(conf);