Closed westerncj closed 7 years ago
Did you try using an e-ng-change
on the checkbox to set the row.amount to 0 when it's checked?
If I set row.amount
using e-ng-change
, then when the cancel button is clicked the value is set to zero.
I tried something like this:
e-ng-change="editableDataForm.$data.amount = (editableDataForm.$data.isActive) ? '0' : row.amount">
what about also changing row.amount
?
If I change row.amount
, the underlying model is changed. I'd like to retain the original values if the Cancel button is clicked.
What happens with this code?
e-ng-change="editableDataForm.$data.amount = (editableDataForm.$data.isActive) ? '0' : row.amount">
When using that code, it doesn't change amount
to 0
in edit mode.
This seems to work, the value is updated and reverted if cancelled...but the ui doesn't seem to reflect the change until after the save/cancel.
e-ng-change="update(editableDataForm)"
$scope.update = function (form) {
form.amount.value = 0;
form.amount.$viewValue = 0
}
I get this error: TypeError: Cannot set property 'value' of undefined
If I console.log the form
coming in I don't see the value
or $viewValue
properties.
Then I would need to seem more of your code.
@westerncj are you still having an issue?
I have an
ng-repeat
editable form like below. How can I set the value ofamount
to0
when it's disabled by the editable-checkbox (isActive)? I have to working so it disables theamount
input wheneditableDataForm.$data.isActive
, but I can't set the value to0
.