My goal is to only allow the button to be enabled if there is text in the textfield, but for some reason I am unable to make ng-disabled
work:
<form novalidate>
<button type="submit" ng-click="add('+')" ng-disabled="bittext.$invalid">Done</button>
<textarea type="text" ng-model="bittext" size="30" placeholder="add bittext here" style="width: 212px; height:100px" required=""></div>
</form>
However, when I attempted it without using $invalid
:
<form novalidate>
<button type="submit" ng-click="add('+')" ng-disabled="bittext">Done</button><!-- no '$invalid'-->
<textarea type="text" ng-model="bittext" size="30" placeholder="add bittext here" style="width: 212px; height:100px" required=""></div>
</form>
In this case, the button gets disabled when there is input in the text field.