Sample code below and here is the fiddle https://jsfiddle.net/eov3762d/4/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>checkbox</title>
<!-- Angular Material style sheet -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.8/angular-material.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body ng-app="BlankApp" ng-cloak ng-controller="CheckboxController">
<md-content>
<div layout="column">
<div layout="row" layout-wrap class="epg-checkbox-group" ng-repeat="filterDatas in filterData" ng-init="outerIndex=$index">
<md-subheader class="md-primary" flex="100">{{filterDatas.title}}</md-subheader>
<div flex="50" class="epg-checkbox" ng-repeat="lists in filterDatas.list " ng-init="innerIndex=$index">
<md-checkbox aria-label="checkbox" ng-model="lists.checked" ng-change="doSomething(lists,lists.checked,lists.listTitle,innerIndex)" ng-hide=lists.removedchecked>{{lists.listTitle}}</md-checkbox >
</div>
<md-button ng-click="clickButton(brands)" class="md-raised md-primary" ng-disabled="isDisabled">Apply</md-button>
</div>
<div ng-if="selectedAlarms" layout="row" layout-wrap>
<md-subheader class="md-primary">Selected</md-subheader>
<div layout="row" layout-wrap flex="100" class="epg-checkbox-group p-b16" ng-repeat="filterDatas in filterData" ng-init="outerIndex1=$index">
<div flex="50" ng-if="lists.removed" class="epg-checkbox" ng-repeat="lists in filterDatas.list" ng-init="innerIndex1=$index">
<md-checkbox aria-label="checkbox" ng-model="lists.checked" ng-change="removefromlist(lists,lists.checked,lists.listTitle,innerIndex1)" ng-hide=lists.removedchecked1>{{lists.listTitle}}</md-checkbox>
</div>
</div>
</div>
</div>
</md-content>
<!-- Angular Material requires Angular.js Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-messages.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-114/svg-assets-cache.js"></script>
<!-- Angular Material Library -->
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.8/angular-material.min.js"></script>
<!-- Your application bootstrap -->
<script type="text/javascript">
/**
* You must include the dependency on 'ngMaterial'
*/
angular.module('BlankApp', ['ngMaterial'])
.config(['$mdThemingProvider', function($mdThemingProvider) {
'use strict';
$mdThemingProvider.theme('default')
.primaryPalette('blue');
}])
.controller('CheckboxController', ['$scope','$filter',function($scope, $filter) {
$scope.filterData = [
{
id: 1,
title: "Attribute Type",
list: [
{
"listTitle": "Attribute 1",
"checked": false,
},
{
"listTitle": "Attribute 2",
"checked": false,
},
{
"listTitle": "Attribute 3",
"checked": false,
},
{
"listTitle": "Attribute 4",
"checked": false,
},
{
"listTitle": "Attribute 5",
"checked": false,
},
{
"listTitle": "Attribute 6",
"checked": false,
},
{
"listTitle": "Attribute 7",
"checked": false,
},
{
"listTitle": "Attribute 8",
"checked": false,
},
{
"listTitle": "Attribute 9",
"checked": false,
},
{
"listTitle": "Attribute 10",
"checked": false,
}
]
}
]
$scope.isDisabled = true;
$scope.$watch('filterData[0].list', function(newval, oldval) {
if (newval !== oldval) {
$scope.brands = [];
$scope.isDisabled = false;
angular.forEach($filter('filter')(newval, {checked:true}), function(lists) {
$scope.brands.push(lists.listTitle);
});
}
}, true);
$scope.doSomething = function(list,bool,name,index) {
$scope.ind=index;
if(!bool){
$scope.filterData[0].list[index].removedchecked=true;
$scope.filterData[0].list[index].removed=true;
}
}
$scope.removefromlist = function(list,bool,name,index) {
if(!bool){
$scope.filterData[0].list[index].removedchecked1=true;
$scope.filterData[0].list[index].removedchecked=false;
}
}
$scope.clickButton = function(brands) {
console.log($scope.innerIndex)
$scope.selectedAlarms = brands;
$scope.filterData[0].list[$scope.ind].removed=true;
$scope.filterData[0].list[$scope.ind].removedchecked1=false;
$scope.filterData[0].list[$scope.ind].removedchecked=true;
console.log(`Selected Alarms = ${$scope.selectedAlarms}`);
}
}]);
</script>
</body>
</html>