I am trying to extract the objects from All_reports that contain the key: comentarioAdmin. Currently, I am retrieving all reports from All_reports, but I only want the reports that have the key comentarioAdmin. Thank you!
getReports() {
this.Service.getReportes().subscribe((data) => {
this.All_reports = data;
console.log('response of student->' + this.All_reports);
});
}
Here is how my array of objects looks like, some with comentarioAdmin and some without:
[
.
.
.
{
"_id": "5ee1b1f04e9bfe060050cacf",
"nombre": "Mario",
"apellido": "López No-Gattelll",
"correo": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0e6d6178676a3f374e696178206376">[email protected]</a>",
"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": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9dfbfcfff2aff2ddfcf2f1b3fef2f0">[email protected]</a>",
"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,
},
.
.
.
]