title: Having issues displaying sqlite db data in nativescript application
body: <p>My app has a scoreboard page that is supposed to fetch data from sqlite db and display it onNavigatingTo page in a ListView but it does not do it as expected.</p>
  
  <p>The xml page to display the results:</p>
  
  <pre><code>&lt;Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" navigatingTo="onNavigatingTo"&gt;
  
  &lt;ActionBar title="Scoreboard"&gt;
    &lt;NavigationButton text="Back" android.systemIcon="ic_menu_back" tap="homeTap"/&gt;
  &lt;/ActionBar&gt;
  
  &lt;StackLayout orientation="vertical"&gt;        
      &lt;Label text="Your Performance Sheet"&gt;&lt;/Label&gt;
      &lt;ListView items= "{{results}}" &gt; 
          &lt;ListView.itemTemplate&gt;
              &lt;Label text="{{testname}}"/&gt;
              &lt;Label text="{{score}}"/&gt;
              &lt;Label text="{{percent}}"/&gt;
          &lt;/ListView.itemTemplate&gt;
      &lt;/ListView&gt;
  &lt;/StackLayout&gt;
  
  &lt;/Page&gt;         
  </code></pre>
  
  <p>The scoreboard-view-model:</p>
  
  <pre><code>var Observable = require("data/observable").Observable;
  var ObservableArray = require("data/observable-array").ObservableArray;
  var Sqlite = require("nativescript-sqlite");
  
  function scoreViewModel (database) {
  
  var viewModel = new Observable();
  
  viewModel.results = new ObservableArray([]);
  
  viewModel.select = function () {
      this.results = new ObservableArray([]);
      database.all("SELECT * FROM scores").then(rows =&gt; {
  
      for (var row in rows) {         
          this.results.push(rows[row]); 
      }
      }, error =&gt; {
          console.log("SELECT ERROR", error);
      })
  }   
  viewModel.select();
  
  return viewModel;       
  }
  
  exports.scoreViewModel = scoreViewModel; 
  </code></pre>
  
  <p>I am selecting all the data from the scores table and pushing to viewModel.results array which is already bound to the view.</p>
  
  <p>The scoreboard.js :</p>
  
  <pre><code>var observable = require("data/observable");
  var scoreViewModel = require("./scoreboard-view-model").scoreViewModel;
  var page;
  var Sqlite = require("nativescript-sqlite");
  
  exports.onNavigatingTo = function (args) {
  page = args.object;
  
  
  (new Sqlite("scoreboard.db")).then(db =&gt; {
      db.execSQL("CREATE TABLE IF NOT EXISTS scores (id INTEGER PRIMARY KEY AUTOINCREMENT, testname TEXT, score TEXT, percent TEXT)")
      .then(id =&gt; {
          page.bindingContext = scoreViewModel(db);           
      }, error =&gt; {
          console.log(error)
      });
  }, error =&gt; {
      console.log(error);
  });
  }
  </code></pre>
  
  <p>Someone please help me get the data to show up in the list view. </p>