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 error in OnsenUI 2

  • I used previous version and was ok. Example for jQuery from
    but now it is retrieving error:

    angular.min.js:107 ReferenceError: MyDelegate is not defined
        at eval (eval at <anonymous> (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10925), <anonymous>:1:1)
        at Class.extend._getDelegate (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10909)
        at Class.extend.init (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10066)
        at new Class (http://localhost/www/components/monaca-onsenui/js/onsenui.min.js:3:22935)
        at http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:4:2064
        at aa (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:73:90)
        at K (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:62:39)
        at g (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:54:410)
        at K (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:61:488)
        at g (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:54:410) <ons-list-item modifier="chevron" class="list_respeak list__item list__item--chevron" ons-lazy-repeat="MyDelegate" style="-webkit-user-select: none; touch-action: pan-y; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">

  • @Евгений-Гедройц Are you using jQuery or AngularJS? The error is for Angular but you are mentioning jQuery. Also, could you post your code preferably in a codepen?

  • Yes, my project has angular and jQuery. i’m using this code:

        <ons-list-item modifier="chevron" class="list_respeak" ons-lazy-repeat="MyDelegate" style="height:40px">
    				var hItem = 40;
    				var MyDelegate = {		  
    					createItemContent: function(index, oldContent) {
    					  if (oldContent) {
    						return oldContent;
    					  var $element = $("<div><span style='opacity: 0.7;'><ons-icon icon='fa-spinner' spin='true'></ons-icon> Загрузка респиков...</span></div>");
    					  var request = $.getJSON('', function(data) {
    					  $'request', request);
    					  return $element[0];
    					destroyItemContent: function(index, element) {
    					  var request = $'request');
    					calculateItemHeight: function(index) {return hItem;},
    					countItems: function(){
    						return 10000000;
    					destroyItemContent: function(index, element) {
    						 console.log("Destroyed item " + index);
    					//if( $(this).height > hItem ){

    In Monaca is good(OnsenUI1) I exported my project to my localhost and changed OnsenUI2
    If it’s not enough i’ll make codepan

  • @Евгений-Гедройц If you can make a codepen, I will play with it and try to figure out what is going on. Also, avoid using the script tag in code blocks because it makes everything faded out. @Leonardo-Augusto and I learned this the hard way. :smiley: