Bootstrap复选框禁用onclick功能

时间:2017-10-25 07:48:31

标签: javascript html css angularjs twitter-bootstrap

我一直在尝试使用Bootstrap将复选框设置为按钮。我使用这些框进行quizz,当你点击一个复选框(按钮)时,它会自动改变问题。当我删除' data-toggle ="按钮"'从我下面的代码。但是然后复选框位于按钮内。当我使用数据切换时,按钮是可点击的,但没有任何反应。这是我的HTML:

<div ng-repeat="choice in question.choices" class="choices">
    <div class="btn-group" data-toggle="buttons">
        <label for="{{choice}}" class="btn edit-set-button choicesbuttons">
            <input id="{{choice}}" type="checkbox" ng-model="option.Selected" ng-change="onSelect(question, choice);" autocomplete="off"/>{{choice}}
        </label>
    </div>
</div>

我的AngularJS代码在点击时切换问题:

$scope.onSelect = function (question, choice) {
          question.choices.forEach(function (element, index, array) {
            question.Answered = choice;
          });

        if ($scope.defaultConfig.autoMove == true && $scope.currentPage < $scope.totalItems) {
            $scope.currentPage++;
        }
        else {
            $scope.onSubmit();
        }
    }

0 个答案:

没有答案