简体   繁体   中英

button property binding “disable” not working in angular 4

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??

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

setTimeout(()=>{    
      this.allowServer = true;
 },3000);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM