Search code examples
androidangularjsionic-frameworkydn-db

Angular/ Ionic Binding slow


I am working on an Ionic tab app and i am using YDN database. I noticed that most of the lists take a while before they are rendered to the screen.

i initially thought it was the YDN database query that was slow but that is not the case. if i add a console Log on completion of the YDN query,i notice that the query is not slow at all.

ydb.getAllQueryable(Feeds_DB_STORE_NAME).order('utcdate').reverse().list(10).done(function(feeds){
  console.log('REFRESH->Finsihed getting feeds: '+ JSON.stringify( feeds[0]));
  $scope.feeds = feeds;


});

But, the binding takes a long time, sometimes as much as 12seconds or more. I am only returning a max of 15 items from the database. And even when i change the query to return only 1 item, it still takes a long time.

I have tried using indexeddb directly before and i didnt have this problem, but indexeddb didnt work on Android <4.4, even though it worked on Windows Phone.


Solution

  • I had an example for AngularJs with YDN-DB. I don't see any delay update using $socpe.apply() to request immediate refresh to AngularJs process cycle. In your native implementation, q promise resolve method will automatically tick process cycle, so you don't have to.