title: Observable add delay - Angular 2
body: <p>I'm implementing a signup page. I want to check whether username already exists. I'm trying to implement asyncvalidator but it calls server everytime user enters a character, can you help in below code to add some delay so it only calls server with username when user stopped typing for some time? I read some observable debounceTime but couldn't get it working. </p>
  
  <pre><code>usernameAsyncValidator(control: FormControl): Observable&lt;any&gt; {
    return new Observable((obs: any) =&gt; {
      return this.http.get('http://localhost:3000/exists?name='+control.value)
        .debounceTime(400)                       &lt;&lt;-----------THIS IS NOT WORKING
        .distinctUntilChanged()                  &lt;&lt;-----------THIS IS NOT WORKING
        .subscribe(
          data =&gt; {
            if (data.status === 200) {
              obs.next({'userNameTaken': true});
            } else {
              obs.next(null);
            }
            obs.complete();
          },
          () =&gt; {
            obs.next(null);
            obs.complete();
          });
    });
  }
  </code></pre>
  
  <p>Please let me know if I can explain better.</p>
  
  <p>-Thanks</p>