Skip to content
This repository was archived by the owner on Nov 22, 2021. It is now read-only.

Commit 00b8e71

Browse files
committed
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.
1 parent 61fae3a commit 00b8e71

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/auto-complete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ angular.module('tags-input').directive('autoComplete', function($document) {
3333
return;
3434
}
3535

36-
loadFn(text).then(function(items) {
36+
loadFn({ $text: text }).then(function(items) {
3737
self.items = items;
3838
if (items.length > 0) {
3939
self.show();
@@ -76,7 +76,7 @@ angular.module('tags-input').directive('autoComplete', function($document) {
7676
'</div>',
7777
link: function(scope, element, attrs, tagsInputCtrl) {
7878
var hotkeys = [KEYS.enter, KEYS.tab, KEYS.escape, KEYS.up, KEYS.down],
79-
suggestionList = new SuggestionList(scope.source()),
79+
suggestionList = new SuggestionList(scope.source),
8080

8181
tagsInput = tagsInputCtrl.registerAutocomplete(),
8282
input = tagsInput.input;

test/auto-complete.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('autocomplete-directive', function () {
3939

4040
spyOn(parentCtrl, 'registerAutocomplete').andReturn(tagsInput);
4141

42-
element = angular.element('<auto-complete source="loadItems"></auto-complete>');
42+
element = angular.element('<auto-complete source="loadItems($text)"></auto-complete>');
4343
parent.append(element);
4444

4545
$compile(element)($scope);

0 commit comments

Comments
 (0)