When I tried to pass values from one server to other server am getting error as "Access to XMLHttpRequest at 'http://localhost:8082/kanchiwork/' from origin 'http://localhost:4200' has been blocked by CORS policy". My .ts file code
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class PeopleService {
constructor(private http:HttpClient) { }
fetchPeople(): Observable<Object>{
return this.http.get('http://localhost:8082/kanchiwork/');
//return this.http.get('assets/response.json');
}
}
where as if I placed the json file(response.json) in assets folder, it is working fine. I have followed the instruction given under the heading "Using corporate proxy" in the below URL, but still problem exists. URL : https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/proxy.md