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.

How can I refresh lazy repeat in Angular 1?

  • I am using a lazy repeat in MEAN.JS. I can successfully do a manual refresh of the lazy repeat if I make a button that on ng-click does “mylazyrepeatdelegate”.refresh(). Another way I can successfully refresh the lazy repeat is by calling an Angular function from my Jade file that changes the scope variable which the lazy repeat uses to determine it’s length. Doing this resizes the list which is what I desire. However, when I try to call refresh() in my Angular code, the lazy repeat does not update. I receive the error that refresh is not a function.

    Looking at my code below, am I doing something incorrectly? Is there a way to call the refresh function in Angular, or can it only be done in ng-click? After scouring the documentation and tutorials, I can only find examples of refresh() in Angular for ng-click.

    The code below does not refresh the lazy repeat and gives me the error that refresh() is not a function. I am calling refresh() after filtering the scope variable (array) that the lazy repeat’s length is dependent on.

    The lazy repeat is currently holding a few items, but due to the nature of my app it could potentially hold thousands of items. I do not want them all to load at the same time which is why I’m using lazy repeat.

    I have defined a lazy repeat as follows (Jade and Angular)…


    Angular Delegate:

    Angular Code to refresh Lazy Repeat:

    I suppose it’s worth mentioning that the delegate is directly below the function in the same controller.

    Error message in the terminal:

    I have found this on GitHub but am unclear on what argelius is saying:

  • Onsen UI

    @rgins16 I cannot see any problem, looks like you understood how to use it. The only possible issue I can think about is that your SearchService.findEventByFilters is completely synchronous and you are creating the delegate object and calling that service in the same cycle. If that’s the case, it would be possible that the delegate object didn’t expose the refresh method yet. Can you try wrapping your service call (or at least the delegate.refresh()) inside a $timeout(..., 0)?

  • Doing as you suggested, I am still receiving the same error. Could this be a bug?

    $timeout(function () {
    … the service…
    }, 0);

  • @Fran-Diox I am using version:


    I will try updating the version.

  • After updating to:


    I am still facing the same issue.

  • Last update:


    The above function correctly refreshes the delegate when I call it using ng-click in a button in my Jade file, but not when I call the function in the service.

  • I solved the issue.

    I don’t like how I solved it, but in the .then of the service, I set the (which contains the new array for the delegate) as a rootscope variable. The lazy repeat updates without the need for me to call refresh().