diff --git a/package.json b/package.json index 29d03d4..76962b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngc-omnibox", - "version": "0.4.3", + "version": "0.5.0", "description": "A modern, flexible, Angular 1.x autocomplete library with limited assumptions.", "main": "dist/ngc-omnibox.js", "scripts": { diff --git a/spec/tests/angularComponent/ngcOmniboxControllerSpec.js b/spec/tests/angularComponent/ngcOmniboxControllerSpec.js index ddd157f..7382c3d 100644 --- a/spec/tests/angularComponent/ngcOmniboxControllerSpec.js +++ b/spec/tests/angularComponent/ngcOmniboxControllerSpec.js @@ -24,6 +24,8 @@ describe('ngcOmnibox.angularComponent.ngcOmniboxController', () => { omniboxController.isSelectable = () => {}; omniboxController.onChosen = () => {}; omniboxController.onUnchosen = () => {}; + omniboxController.canShowSuggestions = () => {}; + omniboxController.source = () => Promise.resolve([]); }); it('should inject $document, $element, and $scope', () => { diff --git a/src/angularComponent/ngcOmniboxController.js b/src/angularComponent/ngcOmniboxController.js index 49d5d6e..71b3896 100644 --- a/src/angularComponent/ngcOmniboxController.js +++ b/src/angularComponent/ngcOmniboxController.js @@ -521,7 +521,9 @@ export default class NgcOmniboxController { if (!this.query) { this.hideSuggestions = true; this.hint = null; - } else { + } + + if (this.canShowSuggestions({query: this.query, omnibox: this}) !== false) { this.updateSuggestions(); } }