I am trying to make one demo in which I have one checkbox . I can display a list using ng-repeat.
What do I need if the user clicks on one checkbox (only one checkbox is selected) .it displays only one column width (100%). Which user checked the two columns, it displays two columns of equal width (50%). if the user checks three columns, he displays three columns of the same width. As if the user had set four checkboxes, it shows four columns with the same width. Normally checked ( checked: true ) ..
- My first step is to uncheck the box with a check of "3" ... but after unchecking it still shows why? I already use splicing. method?
here is my code http://codepen.io/anon/pen/adBroe?editors=101
init(); function init(){ for(var i =0;i<self.data.length;i++){ var obj=self.data[i]; if(obj.checked) { self.selectedList.push(obj); } } alert('starting '+self.selectedList.length) } self.checkBoxClick=function(obj,i){ if(obj.checked) { alert('if') self.selectedList.push(obj); }else { alert('else'+i); self.selectedList.splice(i,1); } alert(self.selectedList.length); } })
here I am trying to display
<div class='container-fluid'> <div class='row'> <div ng-repeat="i in vm.selectedList" class='col-xs-{{12/vm.selectedList.length}}'> {{i.name}} </div> </div> </div>
source share