[SOLVED] this.app is undefined

Hi I am looking for solution why the command this.app returns undefined. The x variable is being undefined

Hi @Lukas_Zahumensky and welcome,

Where are you using that statement? Can you share a bit more of your code?

sorry yes i added an image with code

Hey @Lukas_Zahumensky,

This is because you are referring to it out of scope.
You can try putting this line above the click event handler - var self=this;, and then using self instead of this inside the event handler.
Alternatively, you can also bind this to your event handler, like so -

this.entity.button.on('click', function(event){
   //event handling code here
}.bind(this));
2 Likes

thank you very much this solved the problem

1 Like