如何使用针对离子的typescript从请求标头中获取cookie?

时间:2017-11-29 12:58:26

标签: angularjs typescript cookies ionic-framework

我刚尝试了很多,但我无法找到解决方案,我正在使用JSP Servlet Cookie。

在Chrome浏览器中接收cookie但无法检索它 enter image description here
这是我正在使用的代码:

var obj={"Username":this.username,"Password":this.passwor};


var link = "http://xxxxxx";
var myData = JSON.stringify(obj);
var aa="data="+myData;
let headname = new Headers({'Content-Type': 'application/x-www-form-urlencoded'});
let options = new RequestOptions({headers: headname, withCredentials: true});
this.http.post(link, aa, options)
.subscribe(res => {
   this.response
      let headers: Headers = res.headers;
      headers.get('Set-Cookie');
});

0 个答案:

没有答案