List Search within List with Angular Pipe 2

0

Good morning and Merry Christmas!

Personally, I'm having a problem getting a list back from passing a parameter. This search I'm trying to filter is from a list that is inside another list. If I pass as field a field from the "outside" list, the return works fine. But I can not filter from the list elements inside. I have a list of employees where I'm trying to filter people out of the skills they have. If I look for the name, for example it works, but I must search for the description of his skills. For example: I pass as parameter "json" and the method returns the employees that have Json skill. Can someone help me please? Thank you.

certification: (3) [{…}, {…}, {…}]
gcm: 1
id_employee: 9
manager: "te"
name: "teste t"
project: {id_project: 2, name: "B3", customer: "Ibovespa", valueOfProject: 100000, dtBegin: "2018-07-20T03:00:00.000+0000", …}
role: "tete"
salary: 1234
skill: Array(3)
0: {id_skill: 8, descricao: null}
1:
descricao: "json"
id_skill: 9
__proto__: Object
2: {id_skill: 10, descricao: "js"}
length: 3
__proto__: Array(0)
__proto__: Object
length: 5
__proto__: Array(0)

export class SearchFilterPipe implements PipeTransform {
 transform(items: any[], field: string, value: string): any[] {
   if (!items) return [];
   return items.filter(it => it[field] == value);
 }
    
asked by anonymous 25.12.2018 / 13:55

0 answers