Is there a way to write an angular expression that can check each child item in a list and return true if any child has a specific property value?
My issue involves a chart legend generated by an ng-repeat expression. I want the wrapping element to be shown only if any of the child items in the list has the property "datavisible" set to true.
Currently, I have a $scope variable called "anydatavisible" that is set to true if any of the data series is activated, which I then use in an expression.
<div class="chart-legend" ng-show="anydatavisible">
<div ng-repeat="item in model.Accounts track by item.Id" ng-if="item.datavisible">
{{item.Name}}
</div>
</div>
I am curious if I can achieve the same result by utilizing an expression that checks each child, eliminating the need for the variable "$scope.anydatavisible".
I'm envisioning something like this:
<div class="chart-legend" ng-show="any(model.Accounts).datavisible">
<div ng-repeat="item in model.Accounts track by item.Id" ng-if="item.datavisible">
{{item.Name}}
</div>
</div>