Skip to content

Commit

Permalink
added support for onClear (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarrick authored and miguelcobain committed Apr 28, 2017
1 parent e4bf593 commit 27abd13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addon/components/paper-autocomplete-trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ export default Component.extend({
clear(e) {
e.stopPropagation();
this.set('text', '');
this.get('select').actions.select(null);
this.get('onInput')({ target: { value: '' } });
if (this.get('onClear')) {
this.get('onClear')();
} else {
this.get('select').actions.select(null);
this.get('onInput')({ target: { value: '' } });
}
this.get('onFocus')(e);
this.$('input').focus();
},
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/paper-autocomplete.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
activate=(action "activate")
onBlur=(action "onBlur")
onInput=(action "onInput")
onClear=onClear
placeholder=(readonly placeholder)
onKeydown=(action "onKeydown")
searchEnabled=(readonly searchEnabled)
Expand Down

0 comments on commit 27abd13

Please sign in to comment.