JSFiddle - React, Tailwind, and code Playground
by indatawetrust
HTML
<body ng-app>
<ul ng-controller="selectController">
{{ selectList }}
<li ng-repeat="l in list"><input type="checkbox" ng-click="add(l,select)" ng-model="select">{{ l }}</li>
</ul>
</body>
JavaScript
function selectController($scope){
$scope.list = ['one','two','three','four','five'];
$scope.selectList = [];
$scope.add = function(num,select){
if($scope.selectList.indexOf(num) == -1){
if(!select){
$scope.selectList.push(num);
}
}else{
if(select){
$scope.selectList.splice($scope.selectList.indexOf(num),1);
}
}
}
}