Monaca Onsen UI Discord Chat Github Repo

Ons-lazy-repeat, wait for promise within delegate

  • Hi there,

    i do have a bit of javascript understanding errors and am trying to figure out how to load content before some element is created, however, the content which needs to be loaded will be given by the object which is retrieved within the delegate. I have a onsen lazy repeat list and want to add the element AFTER some content was loaded for this element.

    The content is loaded within a promise.

    newsElement.delegate = {
                createItemContent: function (i) {  
                    var a = loadImage(i).then(function() {
                            return '<div><img src="thepathtotheimagegoeshere"/></div>'
                countItems: function () {                
                    // Return the number of items here.
                    return len;

    I am always getting some “return needs to return a HTML Object”. Any help appreciated :-)