I have a data array containing multiple objects in JSON format. The array looks like this:
var data = [
{
"name": "Jim",
"age" : 25
},
{
"name": "Jerry",
"age": 27
}
];
To display these details, I use the following code:
<div ng-repeat="person in data | filter: query">
</div
The 'query' here corresponds to an input field that allows users to filter the displayed data.
In another location, I show the current count of people being displayed as Showing {{data.length}} Persons
.
My issue is that when a user searches for a person and filters the displayed data, the count of people shown does not reflect the filtered results. It always shows the total persons in the data array instead of the filtered ones. How can I update the count based on the filtered data?