Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
chore(buttons): add demonstration of multiple checkbox
Browse files Browse the repository at this point in the history
- Add demonstration of how to store model when working with multiple checkboxes

Closes #3087
Closes #4065
  • Loading branch information
wesleycho committed Aug 1, 2015
1 parent 2570483 commit 6b90e9e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/buttons/docs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ <h4>Single toggle</h4>
Single Toggle
</button>
<h4>Checkbox</h4>
<pre>{{checkModel}}</pre>
<pre>Model: {{checkModel}}</pre>
<pre>Results: {{checkResults}}</pre>
<div class="btn-group">
<label class="btn btn-primary" ng-model="checkModel.left" btn-checkbox>Left</label>
<label class="btn btn-primary" ng-model="checkModel.middle" btn-checkbox>Middle</label>
Expand Down
11 changes: 11 additions & 0 deletions src/buttons/docs/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@ angular.module('ui.bootstrap.demo').controller('ButtonsCtrl', function ($scope)
middle: true,
right: false
};

$scope.checkResults = [];

$scope.$watchCollection('checkModel', function () {
$scope.checkResults = [];
angular.forEach($scope.checkModel, function (value, key) {
if (value) {
$scope.checkResults.push(key);
}
});
});
});

0 comments on commit 6b90e9e

Please sign in to comment.