我有一个使用此代码创建的onsen懒惰重复列表:
HTML:
<ons-page ng-controller="LazyListController as list" ng-init="init(homeNavigator.topPage.data.wordlistId)">
<ons-toolbar>
<div class="left">
<ons-back-button>Back</ons-back-button>
</div>
<div class="center">{{ homeNavigator.topPage.data.title }}</div>
</ons-toolbar>
<ons-list>
<ons-list-item class="list-item-container" ons-lazy-repeat="MyDelegate" id="lazy_list">
</ons-list-item>
</ons-list>
</ons-page>
JS:
var app = angular.module('myApp', ['onsen', 'ngCordova']);
app.controller('LazyListController', function ($scope, $window, $document, $cordovaCamera) {
$scope.MyDelegate = {
configureItemScope: function (index, itemScope) {
...
},
countItems: function () {
return $scope.wordsInList != undefined ? $scope.wordsInList.length : 0;
},
calculateItemHeight: function () {
return ons.platform.isAndroid() ? 100 : 100;
}
};
updateEditList = function (wordlistId) {
...
$scope.MyDelegate.refresh();
...
});
然而,当我稍后调用$scope.MyDelegate.refresh();
时,我得到刷新不是函数的错误。我不确定如何调用刷新方法!