I'm trying:
- To have a button disabled by default.
- After 4 seconds, the button will be enabled by using a function.
Maximilian instructor used a constructor. But I want to use a function instead, so I wrote below function but it's not working (the button is always enabled).
servers.component.ts:
export class ServersComponent implements OnInit {
allowNewServer = false;
AllowNewServerFunction(){
setTimeout(()=>{
return this.allowNewServer = true;
}, 4000);
}
}
servers.component.html:
<button class="btn btn-primary"
[disabled]="AllowNewServerFunction()">Add Server</button>
AllowNewServerFunctionmethod is returning?