0

I have created a component name servers. In servers.component.ts i have created a variable name allowServer with bool value false (to disable button in start of the app). In constructor, I have used javascript setTimeout function to change the value of allowServer to True. The value is changing but button is not getting enabled

servers.component.ts.

servers.component.html What am i doing wrong??

Akash Pal
  • 126
  • 1
  • 12

1 Answers1

0

You need to use ArrowFunction ()=> to preserve this context within setTimeOut.

setTimeout(()=>{    
      this.allowServer = true;
 },3000);
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396