I am trying to dyanmically display checkbox with labels based on conditional flag. The label values are as follows:
$scope.listA = [
{
name : "Sample 1"
},
{
name : "Sample 2"
}
];
$scope.listB = [
{
name : "Result 1"
},
{
name : "Result 2"
},
{
name : "Result 3"
}
];
This is the html I am using.
<input type="checkbox" ng-repeat="item in listA"/>{{item.name}}
I have a variable based on which i need to display either $scope.listA or $scope.listB.
var mode = "A";
If mode = A then i need to show listA as checkbox labels. If anything else then i need to show listB as checkbox labels.
How can i go about doing this? And how can i make the checkboxes to be checked by default?