Does anyone know why I get the following error?
ERROR Error: Uncaught (in promise): TypeError: this.searchField.valueChanges.switchMap is not a function TypeError: this.searchField.valueChanges.switchMap is not a function
I already tried importing switchMap
and map
in all possible ways, of all possible versions.
this.results$ = this.searchField.valueChanges
// cada cambio (query) en el searchField, hara una consulta
.switchMap(query => this.http.get('${URL}?address=${query}'))
// convertimos la response en json
.map(response => response.json())
// devuelve los resultados finales
.map(response => response.results);