How to solve No 'Access-Control-Allow-Origin' header is present on the requested resource with angular 2 service written with angular-cli?
I have a url that pasting it inside the browser will give me a valid json response. Now, from my localhost, from inside angular-cli I'm trying to get that same json from a service and I get this: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 403 I tried to read about this problem, but didn't understand what I need to do in order my service to work. I'm using angular-cli. this.http.get(this.myUrl) .map(res => res.text()) .subscribe( data => this.jsonResult = data, err => this.handleError(err), () => console.log('Random Quote Complete') ); This returns the error I get.
The problem is not with your app. You are trying to access a REST API from the browser and the server handling will need to be set so it accepts CORS requests. It's not possible to give you more info without the back end and that would be a totally different question.
addons removed in angular-cli.json whats the replacement
angular-cli: ng serve command with config error
Augury Angular-cli When I installed the augury .Error is as follows
Teamcity for building Angular cli app
angular cli update issue on local folder
Access to -aot parameter in code
Missing peer dependencies after installing latest angular-cli: What to do?
angular-cli ng serve : Error: No errors
Getting error after Angular cli update
Does angular-cli uses rollup to do ahead-of-time compilation and adding all into one file?
Angular CLI install error
Using glob for assets in angular-cli throws error
Importing Global SCSS into Component SCSS with Angular-CLI
Error during AOT build with angular-cli 24 and Angular 2.4.1
Add importer to node-sass in angular-cli project
angular-cli#1.0.0-beta.23 (2016-12-15) NOT on npm