The Angular 8 framework is being utilized.
Within an array named teams
, the length can be accessed using teams.length
.
Each entry in the teams
array contains a nested map called teamInfo
. Within this map, there is a boolean value isClosed
that can be accessed by teams.teamInfo.isClosed
for each entry. When iterating through this data in ngForloop, the structure is as follows:
*ngFor="let teamID of JSObject.keys(teams); trackBy: trackByFn
<app-team-card
[team]="teams[teamID]"
[isClosed]="teams[teamID].teamInfo.isClosed">
</app-team-card>
The objective here is to determine the total number of maps where isClosed = true
. An attempt was made with the following method:
getClosedTeams(teams) {
let closedTeams = teams.teamInfo.filter((isClosed) => {
return isClosed.select == true;
});
console.log(closedTeams.length);
}