I have this variable declared in global scope:
export class InboxmanagementComponent implements OnInit {
statmentID: number; // global variable
displayTaskByIdDetails(){
this._inboxServcie.getTask(this.task.id).subscribe(
(data) => {
this.task = data;
this.statmentID = data.statmentID;
console.log('displaying statementId : ' , this.statmentID); // returns 1 because (data.statementId it's value is 1)
}
);
console.log('displaying statementId : ' , this.statmentID); // returns undefined
}
}
So I would liek to copy the value of this.statementID inside arrow function to the global variable