Search code examples
angularjsangularjs-ng-repeatangular-strap

AngularStrap Checkbox button ng-repeat Object selection not reflected


I am using AngularStrap checkbox button where checkbox items come from server. So, I am trying to use ng-repeat, but I am not able to see the values of the item selected. Please see the plunker where I have 3 types of checkboxes in it -

  1. A regular checkbox and it works.
  2. Bootstrap checkbox using ng-repeat. It does not reflect selected object values.
  3. Bootstrap checkbox where items are repeated. It works.

Please help me to fix #2 above where I am using ng-repeat option.


Solution

  • Get rid of the extra tag around the button element:

    http://plnkr.co/edit/jRIedNZdqZ4phdDk21Vw?p=preview

      <div class="btn-group" bs-buttons-checkbox>
                <button ng-repeat="item in items" type="button" class="btn" ng-model="selection.ids[item.id]">{{item.name}}</button>
      </div>