{"action":"created","issue":{"url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/62","repository_url":"https://api.github.com/repos/cmelion/generator-ng2-webpack","labels_url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/62/comments","events_url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/62/events","html_url":"https://github.com/cmelion/generator-ng2-webpack/issues/62","id":163794166,"number":62,"title":"http issue ","user":{"login":"itranga","id":399798,"avatar_url":"https://avatars.githubusercontent.com/u/399798?v=3","gravatar_id":"","url":"https://api.github.com/users/itranga","html_url":"https://github.com/itranga","followers_url":"https://api.github.com/users/itranga/followers","following_url":"https://api.github.com/users/itranga/following{/other_user}","gists_url":"https://api.github.com/users/itranga/gists{/gist_id}","starred_url":"https://api.github.com/users/itranga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itranga/subscriptions","organizations_url":"https://api.github.com/users/itranga/orgs","repos_url":"https://api.github.com/users/itranga/repos","events_url":"https://api.github.com/users/itranga/events{/privacy}","received_events_url":"https://api.github.com/users/itranga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-05T08:11:33Z","updated_at":"2016-07-07T11:09:49Z","closed_at":null,"body":"I am getting an error when I am using below code to access rest API,\r\n\r\nORIGINAL EXCEPTION: TypeError: platform_browser_1.__platform_browser_private__.getDOM(...).getCookie is not a function\r\n\r\nimport {Component, OnInit, Injectable} from '@angular/core'; \r\nimport {FORM_DIRECTIVES} from '@angular/common';\r\nimport {Http, Headers} from '@angular/http';\r\n\r\nimport {Api} from '../../services/api';\r\n\r\n@Component({\r\n    selector: 'home',\r\n    directives: [...FORM_DIRECTIVES],\r\n    providers: [Api],\r\n    pipes: [],\r\n    styles: [require('./style.scss')],\r\n    template: require('./template.html')\r\n})\r\n@Injectable()\r\nexport class Home implements OnInit {\r\n\r\n    constructor(http: Http) {\r\n        this.http = http;\r\n    }\r\n\r\n    createAuthorizationHeader(headers: Headers) {\r\n        headers.append('Authorization', 'Basic ' +\r\n            btoa('username:password'));\r\n    }\r\n\r\n    getRandom() {\r\n        let headers = new Headers();\r\n        this.createAuthorizationHeader(headers);\r\n        return this.http.get('http://localhost:3000/items', {\r\n            headers: headers\r\n        });\r\n    }\r\n\r\n    post(url, data) {\r\n        let headers = new Headers();\r\n        this.createAuthorizationHeader(headers);\r\n        return this.http.post('http://localhost:3000/items', data, {\r\n            headers: headers\r\n        });\r\n    }\r\n\r\n\r\n    ngOnInit() {\r\n        console.log('Hello Home');\r\n    }\r\n}\r\n\r\nbut when I use below code it works perfectly.\r\n\r\nfetch('http://localhost:3000/items').then((response) => {\r\n            return response.json();\r\n        }).then((data) => {\r\n\r\n            console.log(data);\r\n\r\n        }).catch((ex) => {\r\n            console.error('Error fetching users', ex);\r\n        });\r\n\r\n\r\nbut I want to use 1st function since I have to pass header values.\r\n\r\nHow can I solve it.\r\n\r\nThanks\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35751593-http-issue?utm_campaign=plugin&utm_content=tracker%2F32095848&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F32095848&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/comments/231049211","html_url":"https://github.com/cmelion/generator-ng2-webpack/issues/62#issuecomment-231049211","issue_url":"https://api.github.com/repos/cmelion/generator-ng2-webpack/issues/62","id":231049211,"user":{"login":"itranga","id":399798,"avatar_url":"https://avatars.githubusercontent.com/u/399798?v=3","gravatar_id":"","url":"https://api.github.com/users/itranga","html_url":"https://github.com/itranga","followers_url":"https://api.github.com/users/itranga/followers","following_url":"https://api.github.com/users/itranga/following{/other_user}","gists_url":"https://api.github.com/users/itranga/gists{/gist_id}","starred_url":"https://api.github.com/users/itranga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itranga/subscriptions","organizations_url":"https://api.github.com/users/itranga/orgs","repos_url":"https://api.github.com/users/itranga/repos","events_url":"https://api.github.com/users/itranga/events{/privacy}","received_events_url":"https://api.github.com/users/itranga/received_events","type":"User","site_admin":false},"created_at":"2016-07-07T11:09:49Z","updated_at":"2016-07-07T11:09:49Z","body":"I found the solution  . Please change  \"@angular/http\": \"^2.0.0-rc.1\",  to  \"@angular/http\": \"2.0.0-rc.1\", in package.json "}}
{"actor":{"display_login":"itranga"}}