I'm trying to conditionally enable/disable my Save button using ng-disabled:
<button type="button" title="Save Changes" ng-click="onSaveChanges()"
ng-disabled="{{!data.modified}}">
Save
</button>
I have a $scope.data.modified variable that changes to true when my data has been modified. Regardless whether that is true or false, the Save button is enabled. Element inspection reveals that the value of ng-disabled toggles between "true" and "false" as expect but the button is always enabled.
when you are using a angular js attribute (like ng-show, ng-hide, ng-disabled) it should be without the snake notation Ex.ng-disabled="!data.modified"
. For other ordinary attribute like class, id you have to use it with the snake notation. Ex. class={{aVaribaleinControllerScope}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With