Reputation: 410
I have HTML form with fields: input
, textarea
.
All fields have attribute required
and submit button have:
<div ng-click="Share()" ng-disabled="shareForm.$invalid"</div>
How I can check if checkbox is checked or not and disable button?
Upvotes: 1
Views: 6414
Reputation: 2435
Put ng-model
binding on your input:
<div ng-click="Share()" ng-model="checked" ng-disabled="shareForm.$invalid"</div>
And inside your "Share" function:
if($scope.checked){
//do some action if checkbox is checked
}
Upvotes: 3
Reputation: 14187
Use "ng-model" in angular
<input type="checkbox" ng-model="checked"/>
<button ng-disabled="!checked"> MyInput </button>
Upvotes: 3