2016-06-28 75 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 +版本。