title: Autocomplete - select option programmatically
body: <p>I am having an issue when trying to programmatically select an option in an autocomplete.</p>
  <p><code>MatAutocomplete</code> has no select method, so I tried using the select method on the MatOption. This does not appear to do anything.</p>
  <pre><code>matAutocomplete.options.find(opt =&gt; opt.id === 1).select();
  </code></pre>
  <p>Using the Autocompelete _emitSelectEvent(option) method results in firing the optionSelected method but does not update the UI or actually set the option to be selected.</p>
  <pre><code>matAutocomplete._emitSelectEvent(option);
  </code></pre>
  <p>Is there a way to programmatically select an option so that it updates the UI and calls the optionSelected event emitter?</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input [matAutocomplete]=&quot;autocomplete1&quot; /&gt;
  &lt;mat-autocomplete #autocomplete1=&quot;matAutocomplete&quot; [displayWith]=&quot;display1()&quot; (optionSelected)=&quot;selected1($event.option.value)&quot;&gt;
      &lt;mat-option *ngFor=let opt of filteredOptions | async&quot; [value]=&quot;opt&quot;&gt;
          {{ opt.name }}
      &lt;/mat-option&gt;
  &lt;/mat-autocomplete&gt;
  
  &lt;input [matAutocomplete]=&quot;autocomplete2&quot; /&gt;
  &lt;mat-autocomplete #autocomplete2=&quot;matAutocomplete&quot; [displayWith]=&quot;display2()&quot; (optionSelected)=&quot;selected2($event.option.value)&quot;&gt;
      &lt;mat-option *ngFor=&quot;let opt of filteredOptions2 | async&quot; [value]=opt&gt;
          {{ opt.name }}
      &lt;/mat-option&gt;
  &lt;/mat-autocomplete&gt;
  
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>    export class obj {
          public id: number;
          public name: string;
      }
  
      @ViewChild(&quot;autocomplete2&quot;) autocomplete2: MatAutocomplete;
      
      selected1(value: obj): void {
          const opt = this.autocomplete2.options.find(opt =&gt; (opt.value as obj).id === 1);
  
          // Does nothing
          opt.select();
  
          // Fires optionSelected on autocomplete2, does not update the UI
          opt._selectViaInteraction();
  
          // Fires optionSelected on autocomplete2,
          // does not set the option to be selected or update the UI
          this.autocomplete2._emitSelectEvent(opt);
      }
  </code></pre>
  <p>I am using Angular &amp; Material version 5.2.4</p>