private getAllData(): void {
this.stamm_solvara_jahrService.getAll().subscribe(resp => {
const keys = resp.headers.keys();
this.headers = keys.map(key=> `${key}: ${resp.headers.get(key)}`);
this.stamm_solvara_jahrData = {...resp.body};
console.log('Data inside method');
console.log(this.stamm_solvara_jahrData);
console.log('Header inside method');
console.log(this.headers);
});
console.log('Data outside method');
console.log(this.stamm_solvara_jahrData);
console.log('Header outside method');
console.log(this.headers);
}
So inside the subscribe 'process' both instance variables this.stamm_solvara_jahrData and this.headers do have a value. Outside of this they are both empty. How can one solve this?