So I found that angular-ui bootstrap buttons
are made just for this!
What you do is create a button
like usual, set the ng-model
, and then add a btn-radio
tag with the value you would use for radio buttons! I just had to include ui.bootstrap when boot strapping my application.
Here is the JSFiddle with what I have done:
<div ng-controller="Controller" class="container">
<label for="" style="clear: both">Pass / Fail</label>
<div class="btn-group">
<button type="button" class="btn btn-default" ng-model="densityTest.ReportPassed" btn-radio="true">Pass</button>
<button type="button" class="btn btn-default" ng-model="densityTest.ReportPassed" btn-radio="false">Fail</button>
</div>
<div>
<input type="text" ng-model="densityTest.ReportPassed" disabled>
</div>
</div>
angular.module('myApp', ['ui.bootstrap']);
function Controller($scope) {
var densityTest = {};
densityTest.ReportPassed = true;
$scope.densityTest = densityTest;
}