I am trying to make autocomplete on input Text search field with help of jquery.autocomplete.js in angularjs. But it is not working.I checked firebug console there is no error.Please help me.
code
app.directive('autoComplete', function(autoCompleteDataService) {
return {
restrict: 'A',
link: function(scope, elem, attr, ctrl) {
elem.autocompleteArray({
source: autoCompleteDataService.getSource(),
minLength: 2
});
}
};
});
app.factory('autoCompleteDataService', [function() {
return {
getSource: function() {
return ['apples', 'oranges', 'bananas'];
}
}
}]);
Html code
<input type="text" auto-complete/>