From 00b8e71e53fec36a007288a47673ff4e6c73abd1 Mon Sep 17 00:00:00 2001 From: Michael Benford Date: Thu, 28 Nov 2013 01:52:37 -0200 Subject: [PATCH] refactor(autocomplete): Changed load function call Refactored the load function call so it complies with Angular guidelines on invocation of expression properties. A $text parameter is now passed to the provided expression. Closes #18. --- src/auto-complete.js | 4 ++-- test/auto-complete.spec.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auto-complete.js b/src/auto-complete.js index 9d992d9c..5f0a6621 100644 --- a/src/auto-complete.js +++ b/src/auto-complete.js @@ -33,7 +33,7 @@ angular.module('tags-input').directive('autoComplete', function($document) { return; } - loadFn(text).then(function(items) { + loadFn({ $text: text }).then(function(items) { self.items = items; if (items.length > 0) { self.show(); @@ -76,7 +76,7 @@ angular.module('tags-input').directive('autoComplete', function($document) { '', link: function(scope, element, attrs, tagsInputCtrl) { var hotkeys = [KEYS.enter, KEYS.tab, KEYS.escape, KEYS.up, KEYS.down], - suggestionList = new SuggestionList(scope.source()), + suggestionList = new SuggestionList(scope.source), tagsInput = tagsInputCtrl.registerAutocomplete(), input = tagsInput.input; diff --git a/test/auto-complete.spec.js b/test/auto-complete.spec.js index b94954e8..79a16b1f 100644 --- a/test/auto-complete.spec.js +++ b/test/auto-complete.spec.js @@ -39,7 +39,7 @@ describe('autocomplete-directive', function () { spyOn(parentCtrl, 'registerAutocomplete').andReturn(tagsInput); - element = angular.element(''); + element = angular.element(''); parent.append(element); $compile(element)($scope);