Side Menu Listview on enter update


#1

Hey Guys,

This title is not to descriptive but I will explain what I am trying to do. I have a side menu that that controls multiple views and it works just fine. The problem is that one of the views need to make a call to a Parse Database in order to get the data need to update the list. I am able to update my listview when the view is visible with the pull to refresh directive. What I would like to do is also update the list in the same manner when the user enters the view. I have tried a promise with then functions but the view is being display before the data gets there and therefore the list is not updating in real time. Hopefully someone can help me construct the proper promise in order to accomplish this or let me know if what I want to do is even possible. Thanks


#2

Why don’t you use a proper view event?

For example, you can trigger listview population on view load or afterEnter event:

nameApp.controller('ListCtrl', function($scope) {
  $scope.$on('$ionicView.afterEnter', function(){
    // Do something here
  });  
});

Read more about it here: http://www.gajotres.net/using-views-events-to-create-javascript-pure-ionic-splash-screen/