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.
Rendering a template for every element in a data stream - Infinite Lists
Dipanshu Juneja last edited by
I have a stream of data which I want to display in a list. As the title shows, I want to render a template for every element in my data. Basically like the Twitter Interface tutorial but with a stream of incoming data.
I see that
one-lazy-repeattakes a template but how can I use
delegateto modify the contents of this template with the data? Thank you
<ons-list> <ons-lazy-repeat id="infinite-list"> <ons-list-item> <p id="title"> </p> <img id="post_img" /> <p id="author"> </p> </ons-list-item> </ons-lazy-repeat> </ons-list>
@Dipanshu-Juneja The template is passed on the second argument to
createItemContentfunction. However, it’s an html element, not a string. A better way would be using
ons.createElement('<ons-list-item>' + content + '</ons-list-item>')in