0
Hello I started studying Ionic a little while ago and I have the following problem. I have the following ARRAY:
"ordserv": [
{
"codemp": "01",
"numos": "0000000001",
"codcli": "000001",
"datcadast": "2020-05-19T00:00:00.000Z",
"user_id": "INFTEC",
"staos": "7",
"descricao": "Teste",
"codtabpreco": null,
"codcpagto": null,
"subgrupo": null,
"resptecnico": null,
"cli_respfinanc": null,
"datprometida": "2020-12-31T00:00:00.000Z",
"datresposta": null,
"resp_resposta": null,
"numpedcli": null,
"resesperado": null,
"avaliacaofinal": null,
"razsoccli": "EMPRESA USUÁRIA DO SISTEMA",
"numcgccpfcli": "00000000000000",
"descpagto": null,
"razsoccli_respfinanc": null,
"Equipamento": [
{
"codemp": "01",
"numos": "0000000001",
"numequip": "001",
"seriequip": "SER-A001",
"codmat": "0121000003",
"numnf": null,
"sernf": null,
"codforn": null,
"numitemnf": null,
"desmat": "CEO GP4 24 FO PARA INSTALACAO AEREA",
"razsocforn": null,
"numcgccpf": null
}
],
{
"codemp": "01",
"numos": "0000000002",
"codcli": "000002",
"datcadast": "2020-05-19T00:00:00.000Z",
"user_id": "INFTEC",
"staos": "1",
"descricao": "Teste 2",
"codtabpreco": null,
"codcpagto": null,
"subgrupo": null,
"resptecnico": null,
"cli_respfinanc": null,
"datprometida": "2020-12-31T00:00:00.000Z",
"datresposta": null,
"resp_resposta": null,
"numpedcli": null,
"resesperado": null,
"avaliacaofinal": null,
"razsoccli": "VIANET TELECOMUNICACOES E INTERNET LTDA",
"numcgccpfcli": "05884946000181",
"descpagto": null,
"razsoccli_respfinanc": null,
"Equipamento": [
{
"codemp": "01",
"numos": "0000000002",
"numequip": "001",
"seriequip": "SER-A002",
"codmat": 0121000002,
"numnf": null,
"sernf": null,
"codforn": null,
"numitemnf": null,
"desmat": null,
"razsocforn": null,
"numcgccpf": null
}
],
{
"codemp": "01",
"numos": "0000000003",
"codcli": "000001",
"datcadast": "2020-05-21T14:50:06.987Z",
"user_id": "INFTEC",
"staos": "3",
"descricao": "Teste",
"codtabpreco": null,
"codcpagto": null,
"subgrupo": null,
"resptecnico": null,
"cli_respfinanc": null,
"datprometida": "2020-12-31T00:00:00.000Z",
"datresposta": null,
"resp_resposta": null,
"numpedcli": null,
"resesperado": null,
"avaliacaofinal": null,
"razsoccli": "EMPRESA USUÁRIA DO SISTEMA",
"numcgccpfcli": "00000000000000",
"descpagto": null,
"razsoccli_respfinanc": null,
"Equipamento": [
{
"codemp": "01",
"numos": "0000000003",
"numequip": "001",
"seriequip": "SER-A001",
"codmat": "0121000001",
"numnf": null,
"sernf": null,
"codforn": null,
"numitemnf": null,
"desmat": "CEO GP4 24 FO PARA INSTALACAO AEREA",
"razsocforn": null,
"numcgccpf": null
}
],
}
]
I’m trying to filter the ordserv that has in Equipment the codmat I entered into the system. The return I wanted another array but only with the filtered ordserv.
I tried the following code I’ve been researching but failed:
this.ordserv = this.ordserv.filter((f) => f.Equipamento.find(j => j.codmat == this.codmat))
Who can help me thank you so much.