Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs disable button if checkbox is checked

I have a button on a form that I'd like to disable until one or more checkboxes have been selected. This is probably fairly simple to solve, but the button is not disabled when I use !result.isSelected.

This is my button:

<button class="btn btn-success" ng-click="send()"  ng-disabled="!result.isSelected" </button>

And the checkbox:

<input type="checkbox" class="checkbox-row" ng-model="result.isSelected" ng-click="selected()" />

Does anyone know of a better solution? Thanks for your help!

like image 995
1313 Avatar asked Jul 04 '15 17:07

1313


1 Answers

A better solution would be:

<input type="checkbox" class="checkbox-row" ng-model="checked" ng-click="selected()" />

<button class="btn btn-success" ng-click="send()"  ng-disabled="!checked"> </button>
like image 104
Sajal Avatar answered Sep 29 '22 01:09

Sajal