76
rated 0 times
[
77]
[
1]
/ answers: 1 / hits: 53770
/ 10 Years ago, thu, july 24, 2014, 12:00:00
I'm trying to disable enable a button based on an input type value. Here is the Angular JS html code
<div ng-app>
<form name=myForm ng-controller=ctrl>
<input type=text ng-model=name ng-required=true />
<span>{{name}}</span>
<input type=submit value=Submit ng-disabled=myForm.name.$pristine />
</form>
</div>
And the controller code:
function ctrl($scope){
$scope.name = hello;
}
But the button is not getting disabled no matter what.
Here is the DEMO
NOTE: I want the button to be disabled only when text box doesn't have any value and vice versa
More From » angularjs