Button With Ng-disabled Always Enabled July 27, 2023 Post a Comment I'm trying to conditionally enable/disable my Save button using ng-disabled: <button type="button" title="Save Changes" ng-click="onSaveChanges()" ̶n̶g̶-̶d̶i̶s̶a̶b̶l̶e̶d̶=̶"̶{̶{̶!̶d̶a̶t̶a̶.̶m̶o̶d̶i̶f̶i̶e̶d̶}̶}̶"̶>̶ ng-disabled="!data.modified"> Save </button> CopyThe double curly brackets convert the Angular expression to a string. In JavaScript, the string "false" is truthy. Hence both strings "true" and "false" evaluate as truthy and the button is always enabled.Directives which expect boolean values won't work.See Why mixing interpolation and expressions is bad practice. Share Post a Comment for "Button With Ng-disabled Always Enabled"
Post a Comment for "Button With Ng-disabled Always Enabled"