If using Node-server add this in your server.js
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
and Add Hearders in your http method
return this.http.get(
'http://localhost:3000/edata',{
headers: {'Content-Type', undefined} /** Use Content-type as your requirement undifined OR application/json**/
}).map(res => res.json())