Skip to content

Commit

Permalink
bug(autocomplete): deselect the other options when the user select on…
Browse files Browse the repository at this point in the history
…e from the autocomplete

Fixes angular#3689
  • Loading branch information
jefersonestevo committed Mar 20, 2017
1 parent 2dbf87c commit e4dac5a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ export class MdAutocompleteTrigger implements ControlValueAccessor, OnDestroy {
*/
private _setValueAndClose(event: MdOptionSelectionChange | null): void {
if (event) {
this.autocomplete.options.forEach((option) => {
if (option != event.source) {
option.deselect();
}
});

this._setTriggerValue(event.source.value);
this._onChange(event.source.value);
}
Expand Down

0 comments on commit e4dac5a

Please sign in to comment.