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

Commit

Permalink
refactor(autocomplete): Changed load function call
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mbenford committed Nov 28, 2013
1 parent 61fae3a commit 00b8e71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/auto-complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -76,7 +76,7 @@ angular.module('tags-input').directive('autoComplete', function($document) {
'</div>',
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;
Expand Down
2 changes: 1 addition & 1 deletion test/auto-complete.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('autocomplete-directive', function () {

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

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

$compile(element)($scope);
Expand Down

0 comments on commit 00b8e71

Please sign in to comment.