title: angular 5 material 2 - auto complete getting data from external api
body: <p>I'm using angular 5 and material 2.</p>
  
  <p>In ts file, I have this proeperty:</p>
  
  <pre><code>      filteredOptions: Observable&lt;any[]&gt;;
  </code></pre>
  
  <p>This property is going to have an array of values to show in the autocomplete field.</p>
  
  <pre><code>      [{
          id:'1', name: 'teste 1'},
          {id:'2', name: 'teste 2'},
          {id:'3', name: 'teste 3'
        }]
  </code></pre>
  
  <p>This array of values come from the database and it is going to be shown after the user type something.</p>
  
  <p>html file:</p>
  
  <pre><code>          ##            &lt;form class="example-form"&gt;
            ##              &lt;mat-form-field class="example-full-width"&gt;
            ##                &lt;input type="text" placeholder="Assignee" aria-label="Assignee" matInput [formControl]="myControl" [matAutocomplete]="auto"&gt;
            ##                &lt;mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn"&gt;
            ##                  &lt;mat-option *ngFor="let option of filteredOptions | async" [value]="option"&gt;
            ##                    {{ option.name }}
            ##                  &lt;/mat-option&gt;
            ##                &lt;/mat-autocomplete&gt;
            ##              &lt;/mat-form-field&gt;
            ##            &lt;/form&gt;
  </code></pre>
  
  <p>ts file example:</p>
  
  <pre><code>    this.filteredOptions = Observable&lt;any[]&gt;;
  
      ngOnInit() {
        this.filteredOptions = this.myControl.valueChanges
          .pipe(
            startWith({}),
            map(getArrayOfValue(val))            
          );
        }
  
        // it is going to call an api to get the array of values to be shown in the field
        getArrayOfValue(val): Observable&lt;any[]&gt; {            
          const url = this.ROOT_URL + 'veiculo/' + val;
          return this.http.get&lt;any[]&gt;(url);
        }
  </code></pre>
  
  <p>This code give me an error</p>
  
  <blockquote>
    <p>ERROR in src/app/oficina/cadastro/veiculo/veiculo.component.ts(55,5):
    error TS2322: Type 'Observable>' is not assignable
    to type 'Observable'.   Type 'Observable' is not
    assignable to type 'any[]'.
        Property 'includes' is missing in type 'Observable'</p>
  </blockquote>