I have written the user service as to get the user info using the api call.
user.service.ts
getBasicInfo(): Observable<any> {
return this.http.get(this.config.apiUrl + 'api/supplier-basic-info/' + 'userID')
.map(res => res.json());
}
And in the component i have written the observable like this:
user.component.ts
getBasicInfo(){
this._userService.getBasicInfo().subscribe(
data => this.supplierInfo = data.results
);
}
And when i am trying to bind the data in the html component like this:
<div>{{getBasicInfo()}}</div>
Then i am getting the error in the console as:
Failed to load http://<SOME.IP.ADDRESS.>/api/supplier-basic-info/54: 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.
Why i am not able to get the data in the HTML. Can anyone help me on this? As the back end developer is storing the details of user in the cookie. What else i need to do to get the data and bind it in the HTML page using Angular. As i am very new to this Angular4 component based programming.
Thanks.