2016-06-28 56 views
2

我可以看到withCredentials: trueis implemented in angular 2 now角2個GET withCredentials(接受來自服務器的cookies)

要接受來自服務器的cookies。

但是我不知道我該如何使用它。

我試圖

this.http.get(API_PATH + 'auth/getSession/' + TOKEN, { 
    withCredentials: true 
}) 

但西蘭花拋出錯誤

Argument of type '{ withCredentials: boolean; }' is not assignable to parameter of type 'RequestOptionsArgs'

我用角CLI的1.0.0-beta.6。

+0

什麼版本的Angular 2在'packages.json'中使用? – rinukkusu

回答

2

withCredentials可用於Angular2的RC2版本。 Angular CLI 1.0.0-beta.6使用RC1版本。

您應該升級到beta.8才能使用RC2 +版本。