Skip to content

Commit

Permalink
fix(md-autocomplete): find autocomplete using closest, fix #209
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Sep 21, 2016
1 parent 6ef9e2f commit 75b85f4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/autocomplete/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,22 @@ export class MdAutoComplete {
}

detached() {
// remove .autocomplete-content children
$('.autocomplete-content', this.element).off('click');
$('.autocomplete-content', this.element).remove();
// remove .autocomplete-content children
$(this.input).siblings('.autocomplete-content').off('click');
$(this.input).siblings('.autocomplete-content').remove();
}

refresh() {
this.detached();
$(this.input).autocomplete({
data: this.values
});
$('.autocomplete-content', this.element).on('click', () => {
fireEvent(this.input, 'change');
});
// $('.autocomplete-content', this.element).on('click', () => {
// fireEvent(this.input, 'change');
// });
$(this.input).siblings('.autocomplete-content').on('click', () => {
fireEvent(this.input, 'change');
});
}

valuesChanged(newValue) {
Expand Down

0 comments on commit 75b85f4

Please sign in to comment.