UPDATE: I have come to realized that below code is using jQuery-UI and in my requirement I'm suppose to work without any 3rd party dependencies.
so to rephrase my question, how can i change or convert the below code to use just native angularjs rather than using jQuery-ui?
I'm sorry if this is confused to @Roberto Linares & @risto
I have searched and found this directive and I think its light-weight its working as expected if you go to the below jsfiddle but as soon as I changed the version of angularjs to 1.2x (which currently using in my project) getting this error:
TypeError: undefined is not a function
at http://localhost:54893/scripts/directives/auto-complete.js:3:19
iElement.autocomplete({ <<<<ERROR
here is my code:
userApp.directive('autoComplete', function($timeout) {
return function(scope, iElement, iAttrs) {
iElement.autocomplete({
source: scope[iAttrs.uiItems],
select: function() {
$timeout(function() {
iElement.trigger('input');
}, 0);
}
});
};
});
<input auto-complete ui-items="names" ng-model="selected">
selected = {{selected}}
http://jsfiddle.net/sebmade/swfjT/light/ also I have noticed that in jsfiddle its using Jquery UI is that a dependency on this directive? if you know any light-weight directive please let me know as well..
AngularJS directive with 1.2 version: http://jsfiddle.net/abuhamzah/zx8twm2w/ (not working)
Thanks.
jQuery UIdependency?autocompletefunction you are calling is part of jquery UI, not part of Angular. That's why Angular says that the function is undefined if you don't include jQuery UI.