0

I have a problem regarding the example of using the mat-autocomplete material design. The example function presented by google, gives an error in the build, as shown in the image.

Google example at : https://material.angular.io/components/autocomplete/overview#setting-separate-control-and-display-values

this.filteredOptions = this.myControl.valueChanges
      .pipe(
        startWith(''),
        map(value => typeof value === 'string' ? value : value.name),
        map(name => name ? this._filter(name) : this.options.slice())
      );

enter image description here

enter image description here

1 Answers1

0

I solved the problem temporarily, using //@ts-ignore, but I think it is not the best way. What do you say?

  carregarLocaisPorMunicipio(municipio: string){
    this.relatorioService.getLocaisPorMunicipio(municipio).subscribe(
      locais => {        
        this.locais = locais
        this.filteredLocais = this.form.get('local').valueChanges
        .pipe(
          startWith(''),
          //@ts-ignore
          map(value => typeof value === 'string' ? value : value.deLocal),
          map(value => this.filtrarLocais(value))
        );
      }
    )
  }