javascript - autocomplete with angular directive -


i have created angular directive auto complete bellow,

.directive('searchautocomplete',function(){     return function(scope, element, attrs) {         var data = [             {"label":"aragorn", "actor":"viggo mortensen"},             {"label":"arwen", "actor":"liv tyler"},             {"label":"bilbo baggins", "actor":"ian holm"},             {"label":"boromir", "actor":"sean bean"},             {"label":"frodo baggins", "actor":"elijah wood"},             {"label":"gandalf", "actor":"ian mckellen"},             {"label":"gimli", "actor":"john rhys-davies"},             {"label":"gollum", "actor":"andy serkis"},             {"label":"legolas", "actor":"orlando bloom"},             {"label":"meriadoc merry brandybuck", "actor":"dominic monaghan"},             {"label":"peregrin pippin took", "actor":"billy boyd"},             {"label":"samwise gamgee", "actor":"sean astin"}         ];         element.autocomplete({             source:data,         }) ;     } }) 

and html below

<input type="text"  ng-model="sfilter.search_text" searchautocomplete > 

but not working,when model value updated.why?


Comments