I would like to obtain from All_reports the objects that include the key: comentarioAdmin. Now I'm obtaining in All_reports, all the reports, but I just want the reports that include the key comentarioAdmin. Thank you!
getReports() {
this.Service.getReportes().subscribe((data) => {
this.All_reports = data;
console.log('respuesta de alumno->' + this.All_reports);
});
}
This is how I have my array of objects, some of them include comentarioAdmin and others don't:
[
.
.
.
{
"_id": "5ee1b1f04e9bfe060050cacf",
"nombre": "Mario",
"apellido": "López No-Gattelll",
"correo": "[email protected]",
"direccion": "Varsovia 54, Juárez, 06600 Cuauhtemoc, CDMX",
"referencia": "",
"tipoPersona": "Otro",
"comentario": "Hay una fuga a la mitad de la calle.",
"numeroReporte": 2,
"__v": 0,
"comentarioAdmin": "PRUEBA"
},
{
"_id": "5ee1c247634773d6e00e44d4",
"nombre": "Fabián",
"apellido": "Oropeza Oropeza",
"correo": "[email protected]",
"direccion": "Calle 10 de febrero 56 MH, CDMX",
"referencia": "Es mi casa",
"tipoPersona": "Otro",
"comentario": "Justo en rente de mi casa hay una fuga y mi carro se moja cuando salgo.",
"numeroReporte": 1,
"__v": 0,
},
.
.
.
]