0

I'm really not sure how to group the checkbox in angular js which gives looks as shown in the reference image attached here. I'm able to only show list of checkbox but not as shown below.

enter image description here

thanks

3
  • 1
    Wrap them with a div and give it a border? Not angular related issue at all, imo. Commented Apr 5, 2018 at 9:32
  • Give the checkboxes a width: 48% , and then give them float: left;. Commented Apr 5, 2018 at 9:34
  • not related to angularjs Commented Apr 5, 2018 at 10:11

1 Answer 1

1

If you are generating them with ng-repeat you can try to use ng-class-odd to display different style for your checkboxes. You should be looking into CSS, but I gave my attempt at it with this example:

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
  $scope.checkboxes = [
    {"name":"Dehi","value":false},
    {"name":"Kolkata","value":false},
    {"name":"Munbai","value":false},
    {"name":"Pune","value":false},
    {"name":"Chennai","value":false},
    {"name":"Kochi","value":false}
  ];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<style>
  .column {
    float: left;
    width: 50%;
  }
  .row {
    width: 200px;
    background-color: #DDD;
  }
</style>

<div ng-app="myApp" ng-controller="myCtrl">

  <div class="row">
    <div ng-repeat="x in checkboxes" ng-class-odd="'column'">
      <input type="checkbox" ng-model="x.value">{{x.name}}
    </div>
  </div>

</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.