0

I want to make my function wait my variable change the value and then active my function but I don't want to use setTimeout().

My ts:

if (this.dadoscadvp1.relacaoParentescoRespFam == 137) {
    //seta true o radio button1
    this.btn1 = true;
    setTimeout(() => {
        document.getElementById('radioBtn1').setAttribute('checked', 'checked');
    }, 10000);
}
msanford
  • 11,803
  • 11
  • 66
  • 93
Vitor Gonzaga
  • 23
  • 1
  • 6
  • 1
    This is angular, you should use data binding, event listeners, or basically any of the tools Angular gives you to look for change. That's basically the whole point of Angular. – msanford Jul 19 '17 at 13:34
  • 1
    To the list given by @msanford you can add observables, which might be the right tool for you here. –  Jul 19 '17 at 14:09
  • @torazaburo That was the first one I thought of when reading this question, but I left it out because I assume it's simple user input. But very good point. – msanford Jul 19 '17 at 14:18

0 Answers0