0

I have created an angular directive for auto complete like 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 my html like below

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

But it is not working,when the model value is updated.why?

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
Shijin TR
  • 7,516
  • 10
  • 55
  • 122

0 Answers0