Angularjs: after using directive for jquery autocomplete, it doesnt work well. Seem got bugs on that -
as title, when try apply autocomplete angularjs directive. plugin works, however, rest of code after directive being initialize, doesnt work. , not show error.
here online test.
this seems hack me, think it's fine. it's picked while asking question here on (it tip charlieftl).
when you're doing dom manipulation inside directives, it's best after has initialized (kind of ready
callback in jquery). this, can make use of settimeout
or $timeout
(which reason doesn't work in example).
here's fix directive:
myapp.directive('uicomplete', function($http) { return function(scope, element, attrs) { settimeout(function() { element.autocomplete({ source: ["actionscript","applescript","asp"] }); }, 1); } });
and in code: http://jsbin.com/ufihip/7/
Comments
Post a Comment