Avoid unexcepted errors on "angucomplete" inputs #457
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I try to solve two problems in this PR.
1. Use case for the first problem:
Here is the solution:
line 291
.callOrAssign()
method without parameters.callOrAssign()
input without parameters, the handleRequired(true) method is called and the field becomes invalid.callOrAssign()
method without parameters to have an error, otherwise we send the value entered by the user to thecallOfAssign
method.In this way, the error no longer appears while the user writes (if the input is not empty).
2. Use case of the second problems:
Here is the solution:
validState, the problem is that when we empty the input, the
validStatevariable is
""` and it never updated.validState
isundefined
and not if the variable is empty.In this way, if we empty the input, an error appears, but if we rewrite something, now the error disappears.
Here is the configuration of my angucomplete field: