This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
How to edit/delete all text on an "required" field with ng-model-options="{ getterSetter: true }" in AngularJS #11633
Closed
Description
Hi,
I am observing inconsistent behavior while editing field with ng-model-option and required validation.
- If field is not maked as required, on deleting last character, my model is getting called with "" (empty string).
- If field is marked as required, on deleting last character, my model is getting called with undefined.
As per my below code the deleted/undefined value is not being set to my scope.
$scope.name= function(name){
console.log(name);
if (angular.isDefined(name)) {
name1 = name;
}
return name1;
}
Please let me know how to proceed.
StackOverflow: http://stackoverflow.com/questions/29682922/how-to-edit-delete-all-text-on-an-required-field-in-angularjs/29693570#29693570
Plunkr: http://plnkr.co/edit/8QcUsX?p=preview