@shubhanan - thank you for your activity. About using the itemScope - linking the height function to that might affect the performance. The current implementation recalculates the heights if the items count changes, however it does not keep the scopes alive for all the items but rather only for the ones visible in the viewport. So to add that functionality it would need to recreate them or at least call the configureItemScope function, which will probably worsen the performance. Overall it’s best if the logic for calculating the dynamic height is as simple as possible.
Still if you have any suggestions for improvements for the API we would be happy to hear them.
@lezard - currently we don’t offer an API for switching the current index. Lazy repeat was made with the user scrolling in mind, not us navigating. We may think about adding it in the future, but I’m not sure if we should encourage users to do that.
If you want you can just manually scroll to the top. Something along the lines of
// Pure JS
document.querySelector('.page__content').scrollTop = document.querySelector('#lazy-list').offsetTop;
// jQuery
$('.page__content').scrollTop($('#lazy-list').offset().top);
$('.page__content').animate({scrollTop: $('#lazy-list').offset().top}, 250);
// Angular
$anchorScroll('lazy-list'); // 1.4.0+
angular.element('.page__content')[0].scrollTop = angular.element('#lazy-list')[0].offsetTop; // earlier versions
This is assuming you have only one page and that the parent of the element with the ons-lazy-repeat attribute has an id lazy-list.