Following is the url for yahoo finance api working on browser and also using postman [https://query1.finance.yahoo.com/v8/finance/chart/GOOG?range=1y&includePrePost=false&interval=1mo&corsDomain=finance.yahoo.com&.tsrc=finance][1] but getting an error while running from angular 2 app.
Failed to load https://query1.finance.yahoo.com/v8/finance/chart/GOOG?range=1y&includePrePost=false&interval=1mo&corsDomain=finance.yahoo.com&.tsrc=finance: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.
Following is my code
let url = 'https://query1.finance.yahoo.com/v8/finance/chart/GOOG?range=1y&includePrePost=false&interval=1mo&corsDomain=finance.yahoo.com&.tsrc=finance';
console.log(url.toString());
this.http.get(url)
.subscribe(data => {
let jsonData = data.json();
console.log(JSON.stringify(jsonData));
});
I have also added CORS extension