title: Setting Value to ngtypeahead in Model Driven Form(Reactive)
body: <p>I am using Angular Reactive form and having typeahead field via ng-bootstrap typeahead. I am having a list of states created using interface as below -</p>
  
  <pre><code>export interface IContactStates {
     Id: number;
     Name: string;
  }
  </code></pre>
  
  <p>List of states is populated via service and typeahead is initialized in component.ts as -</p>
  
  <pre><code>search = (text$: Observable&lt;string&gt;) =&gt;
    text$
      .debounceTime(200)
      .distinctUntilChanged()
      .map(term =&gt; term === '' ? []
        : this.statesList.filter(v =&gt; 
  v.Name.toLowerCase().indexOf(term.toLowerCase()) &gt; -1).slice(0, 10))
  
  formatter = (x: {Name: string}) =&gt; x.Name;
  </code></pre>
  
  <p>and ngbTypahead is defined as below in html template - </p>
  
  <pre><code>&lt;ng-template #rt let-r="result" let-t="term"&gt;
          {{ r.Name}}
        &lt;/ng-template&gt;
      &lt;div class="col-md-6"&gt;
          &lt;div class="form-group input-group-sm"
              [ngClass]="{'has-error': displayMessage.State}"&gt;
              &lt;label for="State"&gt;State&lt;/label&gt;
              &lt;input class="form-control form-control-sm" formControlName="State" 
              type="text" [ngbTypeahead]="search"
              [resultTemplate]="rt"
              [resultFormatter]="formatter"
              [inputFormatter]="formatter"            
              [editable]="false"
              placeholder="State (start typing the name and then select from list)"
              (selectItem)="selectItem($event)"&gt;
              &lt;span class="help-block" *ngIf="displayMessage.State"&gt;
                  {{displayMessage.State}}
              &lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>This works fine when I am creating new form but when I am trying to edit any already submitted form, State control value is setting undefined. I tried to get any hint on setting the typeahead value from ng-bootstrap help documents but no luck.</p>