@DevVersion
Actual Behavior:
What is the issue? *What is the expected behavior?CodePen (or steps to reproduce the issue): *
@gpopovic The validity is intentionally set to false, when the the searchText is empty, since the md-require-match validator only checks if a item is correctly selected.
I think I can understand why you think about this differently. Can you please explain a bit more, and provide a few arguments, why we shouldn't check when the searchText is empty?
@DevVersion but there is no error at the start (when input is empty)..it creates an error only after i delete some text..
I think this is needed because there are situations when input is optional but if someone decides to write something, we need to force them to select an option.
Let me try to rephrase bug once more..
at the beginning input is empty... there is no error
i write XXXXXX, md-require-match error appears
i delete XXXXXXX, and input is once again empty..
but error does not disappear
This forces people to select something on an optional field.
It's hard to explain it without demo
The md-require-match validator should not depend on the required attribute.
If a user applies the md-require-match attribute, then he explicitly says that the validity will be set to false, when the autocomplete was updated, but no selected item was selected yet.
I don't think a demo is pretty necessary. I understand what you mean.
I'm just curious, what's the correct behavior.
@DevVersion I think the correct behavior is for the md-require-match to show an error message only if the user provides a value that doesn't match.
If you also want an error when no value is provided, then you should set required="true".
I think this gives developers the most choice/flexibility. If it does not currently work this way, then I would say this is a bug.
@topherfangio That seems to make sense. Especially the point, with providing more flexibility.
When I recently introduce that functionality, I intentionally didn't include that discussed behavior, so it's actually not a bug (Also the documentation isn't misleading)
I'll try to get this in before 1.1
Hey @DevVersion, angular-material is already on version 1.1.1.
Is this new behavior going to be on this same version or only in the next one?
This is exactly what I wanted!
@andrehil This fix should be available in 1.1.2
Nice work on this. Just wondering if since it's a breaking change should the minor version be bumped instead of the patch version?
Most helpful comment
@andrehil This fix should be available in 1.1.2