title: Angular 6 setTimeout Module not found: Error: Can't resolve 'timers'
body: <p>I have a problem. I want to use <code>setTimeout</code> in angular to call a function after 2 second but I get this:</p>
  
  <blockquote>
    <p>ERROR: Module not found: Error: Can't resolve 'timers'; this is my function:</p>
  </blockquote>
  
  <pre><code>login(user) {
    console.log(user.value);
    this.loginService.loginUser(user.value);
    // this.user = this.loginService.getUser();
    setTimeout(() =&gt; {
      this.user = this.loginService.getUser();
    }, 2000);
    if (this.user === undefined) {
       console.log('username or password incorrect');
    } else {
      console.log(this.user);
      this.navbar.connectComps(this.user);
      this.navbar.getCheck();
    }
  }
  </code></pre>
  
  <p>Please tell me what should I do to solve this issue.</p>