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

feat(autocomplete): allow select on match to be case insensitive. #6935

Conversation

devversion
Copy link
Member

Fixes #5782

@devversion devversion force-pushed the feat/autocomplete-match-insensitive branch from 265fb7d to e2587f7 Compare January 31, 2016 10:46
if (searchText == displayValue) select(0);
var isMatching = searchText == displayValue;
if ($scope.matchInsensitive && !isMatching) {
isMatching = searchText.toLowerCase() == displayValue.toLowerCase();
Copy link
Member Author

Choose a reason for hiding this comment

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

Not using a ternary operator here, because it will be really unclear.
isMatching == false is just saving up an unnecessary step.

placeholder: '@placeholder',
noCache: '=?mdNoCache',
selectOnMatch: '=?mdSelectOnMatch',
matchInsensitive: '=?mdMatchCaseInsensitive',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's invert the logic here. Better name is matchCase which should have default value == false.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ThomasBurleson If understood everything right ->

  • By default it will ignore case
  • Allows caring about case when using md-match-case="true"

Updated it to behave as this. See specs for example.

@ThomasBurleson ThomasBurleson added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: work labels Feb 4, 2016
@ThomasBurleson ThomasBurleson added this to the 1.0.6 milestone Feb 4, 2016
@ThomasBurleson ThomasBurleson self-assigned this Feb 4, 2016
@devversion devversion force-pushed the feat/autocomplete-match-insensitive branch 2 times, most recently from 3476db5 to 659a4e6 Compare February 4, 2016 17:56
@devversion devversion force-pushed the feat/autocomplete-match-insensitive branch from 9607e4e to a9286de Compare February 4, 2016 17:59
@devversion
Copy link
Member Author

@ThomasBurleson is that by intention, that you merged the old version? without the change md-match-case?

@devversion
Copy link
Member Author

Would be great if you give a small statement to this 👍

ErinCoughlan pushed a commit to ErinCoughlan/material that referenced this pull request Feb 9, 2016
@gigablox
Copy link

CodePen? I can't get this too work.

@devversion
Copy link
Member Author

@gigablox Just apply the new attribute md-match-case="false".

@devversion devversion deleted the feat/autocomplete-match-insensitive branch April 19, 2016 19:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants