I'm trying to do some basic stuff in Typescript. I've declared a class like this. Since I want to use the member properties of the class I don't want to use the this keyword in the nameChanged function.
class testController {
constructor()
{
}
reaction:string = "trist";
name:string = "erik";
showReaction:boolean = false;
nameChanged()
{
if(name=="olle")
{
this.reaction = "Yippie";
this.showReaction = true;
}
else { this.showReaction = false; }
}
}
If I write the row
this.reaction = "Yippie";
whitout the 'this' keywork I get a compilation error. Could not find symbol 'reaction'. The same thing goes for the showReaction property, but name behaves like expected.
Am I missing something? How can I make reaction and showReaction behave like name?