I have an object with nested children, like this:
$scope.artists.materials.items[] //contains list of items
Now I need to compare the total length of each artist's list of items. If there is a mismatch in the number of items between artists, I want to return true or false.
For example, if Artist1 has 2 items and Artist2 has only 1 item, it's considered a mismatch as I need both artists to have the same number of items.
However, I'm unsure how to make this comparison using AngularJS.
Code:
function checkItemsValidity() {
angular.forEach($scope.artists, function (artist) {
alert(artist.materials.items.length);
});
}
What would be a better approach to achieve this?