I am writing some typescript code and iterating an array. Inside the loop, I am trying to access \'this\' object to do some processing as:
console.log(\'befo
Add the this as a parameter for callback.
this
Adding }, this); instead of }.bind(this)); should resolved issue in Angular.
}, this);
}.bind(this));
Thus, should look like:
myarray.days.forEach(function(obj, index) { console.log('before transform, this : ' + this); this.datePipe.transform... }, this);