My Angular-built menu uses JSON and spans up to 3 levels deep. Some items have no children, while others go further down the hierarchy. I'm trying to determine if a selected subcategory has child elements in order to hide a button.
Each time a subcategory like "Digital Art" is selected, it's stored in $scope.selectedSubMarket;
How can I check within $scope.art if an object with cat: Digital Art has child objects? For example, 'Comics' doesn't have a second level - how can I handle this?
Below is a snippet of the JSON used for building the menu:
$scope.art = [
{"cat": "Digital Art", "second": [
{...},
]},
{"cat": "Traditional Art", "second": [
{...},
]},
{...}
]