Can anyone please explain how I can access a component variable within a foreach loop? Check out my code on Plunker
public exampleVariable:number;
test(){
console.log('fired');
var x =[1,2,3,4];
x.forEach(function (e){
this.exampleVariable = e;
})
console.log( this.exampleVariable);
}