Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

feat(autocomplete): pass md-input-max/min-length to the input with no… #9964

Merged
merged 1 commit into from
Dec 6, 2016

Conversation

theLufenk
Copy link
Contributor

…n-floating label

Adds the md-input-minlength and md-input-maxlength attributes as ng-minlength and ng-maxlength to the input element of the autocomplete directive when a floating label is not used.
A use case : It would help in validating the input when the value of Search Text is being used if no matches are found.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@theLufenk
Copy link
Contributor Author

I believed it would be taken up with #4492 . However it wasn't.
As of now, there is no way to add length validation to the text input element.

The value of Search Text is exposed , hence it can be used in a scenario when we want the autocomplete to serve as both a suggestion list as well as text input .

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@devversion
Copy link
Member

Thanks for the pull request - The reason why the ng-min/max-length attributes are not supported a normal autocomplete is that we don't support ng-messages for a normal autocomplete.

My question here is, how will you validate the "underlaying" input?

@theLufenk
Copy link
Contributor Author

The property is exposed as [FORM_NAME].[MD_INPUT_NAME].$error.maxlength nonetheless.

@devversion
Copy link
Member

@theLufenk Ah I see. From this perspective it makes sense to support those validator attributes for the normal autocomplete.

Can you please some tests for those two attributes?

@devversion devversion self-assigned this Nov 2, 2016
@devversion devversion added needs: review This PR is waiting on review from the team needs: unit tests This PR needs unit tests to cover the changes being proposed labels Nov 2, 2016
@theLufenk
Copy link
Contributor Author

Added tests. The spec was missing tests for md-input-minlength. Added them too.
I suppose checking for presence of ng-maxlength/ng-minlength attribute in the render input element and $valid state of container forms would be sufficient ?

@devversion
Copy link
Member

devversion commented Nov 2, 2016

@theLufenk Perfect! I think the tests which are only checking for the attribute on the input are not necessary when having the tests for the $valid state.

If you have time it would be great to have them removed (those are unnecessary and bloating the specs)

@devversion devversion removed the needs: unit tests This PR needs unit tests to cover the changes being proposed label Nov 2, 2016
…n-floating label

Adds the md-input-minlength and md-input-maxlength attributes as ng-minlength and ng-maxlength to the input element of the autocomplete directive when a floating label is not used.
A use case : It would help in validating the input when the value of Search Text is being used if no matches are found.

Added Unit tests for md-input-maxlength and md-input-minlength
@theLufenk
Copy link
Contributor Author

Done and rebased.

Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@theLufenk theLufenk added needs: presubmit and removed needs: review This PR is waiting on review from the team labels Nov 7, 2016
@theLufenk theLufenk added this to the 1.1.2 milestone Nov 7, 2016
@mmalerba mmalerba merged commit 388a340 into angular:master Dec 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants