Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

button with ng-disabled always enabled

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.

like image 361
Hilo Avatar asked May 13 '13 17:05

Hilo


1 Answers

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}}

like image 83
Rajkamal Subramanian Avatar answered Oct 11 '22 13:10

Rajkamal Subramanian