title: debounce to get a value input in angular2
body: <p>I want to get a value from an input text after a few time (many millisecond or seconds) in angular 2, when a custom write an input but without waiting him to click a button.</p>
  
  <p>I have tried this, but even when I use <code>debounceTime</code>, value is send in every keypress.</p>
  
  <p>I try to learn about debounce and observable and this is what I understand, Can anyone please help me to fix my code:</p>
  
  <p><strong>component.html:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;md-card-title *ngIf="!edit"&gt;{{card.title}}&lt;/md-card-title&gt;
   &lt;input *ngIf="edit" type="text" [(ngModel)]="card.title" (ngModelChange)='rename()'/&gt;
  </code></pre>
  
  <p><strong>component.ts</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>newTitle: string;
  modelChanged: Subject &lt; string &gt; = new Subject &lt; string &gt; ();
  
  constructor()
  this.modelChanged
    .debounceTime(500) //before emitting last event
    .distinctUntilChanged()
    .subscribe(model =&gt; this.newTitle = model);
  }
  
  rename(): void {
    this.renameRequest.emit(this.newTitle);
  }
  </code></pre>