https://jsbin.com/yikobayuqa/edit?html,js,output
I have two blocks of checkboxes buttons i need to toggle between based on what the value of a radio button reads.
The code i have written gets shows each block if the rel. radio has been selected, but it doesn't hide when the other radio button is selected which is what i am trying to get it to do..
The contents of the controller
$scope.choosenTopLevelReason = false;
$scope.reportTopLevelReasons = [{
title: "I do not think this should be on this site.",
subReasons:[{
title: "It is pornography",
on: false
},{
title: "It is distasteful",
on: false
},{
title: "It is spam",
on: false
}]
},{
title: "This does not interest me",
subReasons:[{
title: "Hide this",
on: false
}]
}];
The HTML partial
<ul>
<li ng-repeat="reportTopLevelReason in reportTopLevelReasons">
<label><input type="radio" name="topLevelReason" value="{{reportTopLevelReason.title}}" ng-model="choosenTopLevelReason"> {{reportTopLevelReason.title}}</label>
<ul ng-show="choosenTopLevelReason == reportTopLevelReason.title">
<li ng-repeat="subReason in reportTopLevelReason.subReasons">
<label>
<input type="checkbox" ng-model="subReason.on" ng-checked="subReason.on">
{{subReason.title}}
</label>
</li>
</ul>
</li>
</ul>
Could anyone assist?