I am new to Angular2. I am trying to implement an authentication to an app with a username and password login credentials but I always get a "No Access-Control-Allow-Origin"
below is my code:
onSubmit() {
let headers = new Headers();
headers.set('Content-Type', 'application/json');
headers.set('Access-Control-Allow-Origin', 'http://local.press.hosting:8080');
headers.set('Access-Control-Allow-Credentials', 'true');
headers.set('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
this.http.post('http://staging.press.hosting:9000/api/v1/adminLogin', JSON.stringify({"username":this.username,"password":this.password}),{headers:headers})
.subscribe((res)=>{
console.log(res)
});
}