angularjs - Fetch data from sqlite and display it in autocomplete -


i'm working iphone application using phonegap. in application there few dropdowns values more 10000. trying replace dropdown autocomplete.

we maintaining 10000 records in sqlite db , fetch records db user enters string.

code:

<input type ="text" class="inputformtext" ng-model="location.location" id="location" list ="locvalues" placeholder="{{'lsummary_location_text'|translate}}"  autocomplete = "on" maxlength="80" ng-keyup="populatelocations($event)"/>              <div class="alistcon">                 <datalist id="locvalues">                  </datalist>             </div>  $scope.populatelocations = function($event){                if ($event.target.value.length > 2) {                     try                     {                           db.transaction(function(tx){                                 tx.executesql("select id, value tbl_location value '%" + $event.target.value + "%'", [],                                        function(tx, res){                                              if(res.rows.length > 0)                                             {                                                   var template = "";                                                   (var = 0; < res.rows.length; i++) {                                                           var id = res.rows.item(i).value + ' / id: ' + res.rows.item(i).id;                                                         template += '<option class="acon" id="' + id + '" value="' + res.rows.item(i).value + '"></option>';                                                   };                                                    document.getelementbyid('locvalues').innerhtml = template;                                             }                                             else                                                 console.log("no records found")                                         },                                       function(ex){                                             console.log("populate location error: " + ex.message);                                       });                           });                     }                     catch(ex)                     {                           console.log("populate location error: " + ex.message);                     }               };         }; 

i able fetch records form sqlite , append datalist, autocomplete not displayed in ui.

any idea i'm going wrong?

thanks in advance

this code should working:

var divtoappend=angular.element( document.queryselector( '#locvalues' ) ); divtoappend.append("<option class="acon" id="' + id + '" value="' + res.rows.item(i).value + '"></option>"); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -