How to access Response cookies in angular2?
<p>I'm trying to access this cookies (the response ones):
<a href="https://i.stack.imgur.com/IORUZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IORUZ.png" alt="enter image description here"></a></p>

<p>When I open the request in the chrome debug tools in the network section I can clearly see that the cookies are present, but how can I access those values from my code? I've never worked with cookies before and I don't know what to do to "extract" them... I'm working on a Ionic2 project using Http.</p>

<p>I've read that the <code>allowCredentials: true</code> header has to be sent but that didn't work... </p>

<h2>Here's the request/response details:</h2>

<p><a href="https://i.stack.imgur.com/jGL86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jGL86.png" alt="enter image description here"></a></p>

<h2>Here's the service:</h2>

<pre><code>public callLogin(service_guid: string, pos_guid: string, login_data: Object) {

        return this.http.post(
            this.url + service_guid + "/" + pos_guid + "/ack", 
            login_data,
            {withCredentials: true}
            )
            .map(response =&gt; response.headers);
    }
</code></pre>

<h2>And the caller:</h2>

<pre><code>this.__posService.callLogin(login_data.service_guid, login_data.pos_guid, {"password": data.password})
                            .subscribe(
                                res =&gt; {
                                    console.log("Success:");
                                    console.log(res.get("apsession"); // this returns undefined
                                },
                                err =&gt; {
                                    console.log("Error:");
                                }
                            );
</code></pre>

<p>When I try to access the cookie from the header it returns <strong>undefined</strong>. What am I doing wrong here? </p>