JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app='myApp' ng-controller="Controller">
<div ng-init="initCount(i = $index)" ng-repeat="emp in records">
<b>Can Vote :</b> {{voteCount[i]}}<br>
<b>Indians :</b> {{indiansCount[i]}}
<div ng-repeat="empl in emp" ng-init="incrementCount(empl, i)">
{{empl.country}}<br>
{{empl.employee.name}}<br>
{{empl.employee.canVote}}
<hr>
</div>
</div>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('Controller', function ($scope) {
$scope.indiansCount = [];
$scope.voteCount = [];
$scope.records = {
"Employee 1" : [{
country:"Indian",
employee: {canVote : true, name: "Manu"}
},
{
country:"Indian",
employee: {canVote : false, name: "Danny"}
},
{
country:"American",
employee: {canVote : true, name: "Sunny"}
}],
"Employee 2" : [{
country:"Indian",
employee: {canVote : true, name: "Mary"}
}]
};
$scope.initCount = function(i) {
$scope.indiansCount[i] = 0;
$scope.voteCount[i] = 0;
}
$scope.incrementCount = function(empl, i) {
console.log(empl);
if(empl.country === "Indian") {
$scope.indiansCount[i]++;
}
if(empl.employee && empl.employee.canVote === true) {
$scope.voteCount[i]++;
}
};
});