Hi,
I try to use angular 2 pipe to filter array:
adresse-search.pipe.ts:
@Pipe({
name: 'adresse-search',
pure: true
})
@Injectable()
export class AdresseSearch implements PipeTransform{
constructor(){
console.log("hello from pipe")
}
transform(value:any,args?:any[]) {
value.map(content => content)
.concatMap(arr => Observable.from(arr))
.filter(adresse =>
{
if (adresse == null){
adresse
}
else{
adresse.doc.a_id.toString().contains(args[0]) || adresse.doc.a_adresse.toString().contains(args[0]) || adresse.doc.a_code_postal.toString().contains(args[0]) || adresse.doc.a_ville.toString().contains(args[0])
}
})
.subscribe(val => console.log("filtred "+val))
}
}
app.module.ts:
@NgModule({
declarations: [
...
, AdresseSearch
]
But I have an error on execution :
Unhandled Promise rejection: Template parse errors:
The pipe ‘AdresseSearch’ could not be found