JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app ng-controller="ShowHide" ng-init="parents=[{
"father":"John",
"mother":"Mary",
"kids":[{
"name":"Tom"},
{"name":"Jenny"}]
},{
"father":"Robert",
"mother":"Jane",
"kids":[
{"name":"Tina"},
{"name":"Harry"}
]
}];">
<ul ng-repeat="parent in parents">
<li>Mother: <i>{{parent.mother}}</i></li>
<li>Father: <i>{{parent.father}}</i></li>
<a href="#" ng-click="showKids()">Show Kids</a>
<ul ng-repeat="kid in parent.kids" ng-show="active">
<li>{{kid.name}}</li>
</ul>
</ul>
</div>
JavaScript
function ShowHide($scope) {
$scope.active = false
$scope.showKids = function() {
if ($scope.active == false) {
$scope.active=true
}
else {
$scope.active=false
}
}
}