How to count in array and show in a card angular 2 / ionic 2


#1

Hello guys,

Currently I am busy with a project. I use Ionic cards to show my students in a group.
I used *ngFor=“let item of items”> to get the students in a card. I use a JSON object.
I used

{{ items.length }}

but that way it counts everything in items. What I want is to show only a certain group not everything. How many studens do I have in Group 1. Show it as “31 studens in group 1”

#2

I have to group the groups but I do not know how to do that. I searched and tried some things but it didnt work for me.


#3

You need to specify this in the search. The code is right there.


#4

How do I specify it. That is my problem. I kinda dont know how to do it. I have to group the groups and then count the length of the group. I can count the length but i dont know how to group the groups


#5

This is done in sql. Do you use webservice?


#6

I dont hae a database. I have a JSON object. Nothing from the database only from an array