Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

feat(typeahead): Adds 'select on exact' setting. #3365

Closed
wants to merge 1 commit into from

Conversation

JasonTypesCodes
Copy link
Contributor

While using the typeahead directive, we desired that it automatically select an item when the user input exactly matches the option in the dropdown. This PR is an implementation of this feature.

I called the new attribute typeahead-select-on-exact and it takes a boolean. I've added tests and updated the docs. I tested it locally against IE 10, FF 32, and Chrome 41 using Angular 1.3.13 and 1.2.26.

I also believe this will resolve issue #3310

@ghost
Copy link

ghost commented Mar 13, 2015

👍

2 similar comments
@mrmojorisin0625
Copy link

👍

@abondin
Copy link

abondin commented Mar 20, 2015

👍


* `typeahead-focus-first`
_(Defaults: true)_ :
Should the first match automatically be focused as you type?
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this was moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I was looking for where to add the documentation for the new attribute, I noticed that they were almost in alphabetical order (except for focus-first) and assumed that they were supposed to be so I moved 'focus-first' to higher up in the list. Looking again, I see I misplaced 'select-on-exact' anyway... so I've fixed that now. I'm happy to order them differently if I'm incorrect.

@wesleycho
Copy link
Contributor

I like this overall - I am going to schedule this for 0.13.1, since we locked down 0.13.0 for Angular 1.3 compatibility.

@wesleycho wesleycho added this to the 0.13.1 milestone Apr 5, 2015
@JasonTypesCodes
Copy link
Contributor Author

@wesleycho I want to squash this but don't want to destroy history for future reviewer(s). Would you mind if I squash this soon(ish), or should I wait until after it has been reviewed?

@@ -154,6 +166,11 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
scope.position.top = scope.position.top + element.prop('offsetHeight');

element.attr('aria-expanded', true);

//Select the single remaining option if user input matches
if(selectOnExact && scope.matches.length === 1 && inputIsExactMatch(inputValue, 0)){
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a space here after if

@wesleycho
Copy link
Contributor

I'm fine with squashing now - the merge commits are polluting the history, and would be troublesome to rebase with.

@JasonTypesCodes
Copy link
Contributor Author

Squashed.

@wesleycho wesleycho modified the milestones: 0.13.1 (npm), 0.13.2 (Performance) Jul 23, 2015
@wesleycho wesleycho closed this in 277b30c Jul 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants