Here is my code :
onClick() {
console.log("I am running...");
let headers: Headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa("Userid:password") );
headers.append("Content-Type", "application/json");
let options = new RequestOptions({ headers: headers });
return this.http.get(this.url, options)
.map((response: Response) => {
console.log(response);
}).subscribe();
}
I am getting error : 401 (Unauthorized)
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. The response had HTTP status code 401.
Kindly provide me some solutions.