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.

http://jsbin.com/ufihip/4

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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -