Angular 6 accessing REST failing with Access-Control-Allow-Origin
问题 So I am trying to load the data from a REST source into my Angular 6 app using http: HttpClient from '@angular/common/http' . Calling the app in the browser using ng serve --open though doesn't do the job. I assume CORS to be the problem here. I guess I either have to set the server or the client headers with Access-Control-Allow-Origin or something, but I have already tried multiple ways without any success in making this simple REST call work. So what follows below is what I coded. Calling