How To Access This Variable Inside This Function
I have private variables in constructor and public variables in the class. I refer to this variables and functions using this keyword. I am getting undefined if I try to access thi
Solution 1:
Make use of Arrow function which preserves the value of this
this.$http(data).then((response) => {
console.log(response);
console.log(this.company);
console.log("Prints window object", this);
}).catch(function (error) {
console.log(error);
});
Post a Comment for "How To Access This Variable Inside This Function"