Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

ons-lazy-repeat won't realize the changes on the model if the size of the list did not change.

  • I am hitting the issue that LazyRepeat won’t realize the changes on the model if the size of list did not change.
    Say, in the code at,
    if i tweak the size of the first array from 50 to 26, it does not seem to work.
    Hitting ‘Change Array’ do nothing.
    Is it supposed to be so or will be fixed in the future?

    $scope.myArrayFilters[0] = [];
      var i;
      for (i = 0; i < 26; i++) { // make both of arrays the same size.
        $scope.myArrayFilters[0].push({content: i});
      $scope.myArrayFilters[1] = [];
      for (i = 0; i < 26; i++) {
        $scope.myArrayFilters[1].push({content: String.fromCharCode(97 + i)});

  • Even though it may be changed in the future, right now maybe it doesn’t seem realistic to expect it to do that.

    Currently the API receives 2 functions - one for creating an item (scope or content) and one for getting the length of the list. Since we never receive the list itself trying to watch the functions for all the available items is likely to cause a very bad performance loss.

    Lazy-repeat was designed for very large lists (from thousands to million items) and thus watching the items for changes doesn’t make much sense. Watching the list size is probably not even really that necessary, but I guess it doesn’t cause any issues. Since the most likely use of the lazy-repeat is an infinite list which makes api calls for the next items it’s just a small bonus for it.

    I guess we aren’t really providing an easy API for your case. There is a refresh() method which would be the easiest solution. So something like lazyRepeat._provider.refresh(). I guess there are some potential changes for this component, but I guess revealing information may be misleading at this point.

    If you need this case working right now I guess your options are things like $scope.apply(), calling the aforementioned refresh, or doing a hack with changing the length temporarily.

  • @IliaSky Thanks a lot. In fact, as you mentioned, we go with reload function to replace the data so Lazy-repeat can refresh the view. The thing is, the size of our data would be at most 300, and the entire list can be sorted, that is why we needed to refresh the view once sorted.

  • @tfutada Glad I could be of help. If your data is around 300 elements then maybe you don’t even need ons-lazy-repeat, maybe a simple ng-repeat could be sufficient, but I guess if you want to use lazy-repeat that’s also fine. It may still yield better performance even though the difference may not be very big. :)