I need to break down a string using commas as separators into an observable for an autocomplete feature.
The string looks something like this:
nom_commune = Ambarès,ambares,Ambares,ambarès
My goal is to extract the first value from the string: Ambarès
I attempted to split it into the observable but encountered this error:
Property 'split' does not exist on type 'boolean'.
return this.http.get<IUserResponse>('https://tu.com/agriobs-codeigniter/index.php/structure/get_area/17').pipe(
map((response: IUserResponse) => {
response.results = response.results
.map(user => new User(user.id_commune, user.nom_commune))
.filter(user => user.nom_commune.includes(filter.name).split(",")[0])
// console.log(response.results[0].nom_commune.split(",")[0]);
return response;
})
);