如何通过onclick事件更改ons-lazy-repeat委托

时间:2018-09-28 20:08:07

标签: onsen-ui onsen-ui2

在下面的示例中,为什么在按下按钮时列表不会变为“更改”?

<ons-page ng-controller="ListController as list">
    <ons-button ng-click="list.loaddata()">clickme</ons-button>
    <ons-list>
        <ons-list-item ons-lazy-repeat="list.delegate">{{ item }}</ons-list-item>
    </ons-list>
</ons-page>

和JS:

module.controller('ListController', function () {
    this.name = '';
    this.loaddata = function () {
        this.name = "changed";
    };
    this.delegate = {
        configureItemScope: function (index, itemScope) {
            itemScope.item = this.name;
        },
        countItems: function () {
            return 20;
        },
        calculateItemHeight: function () {
            return ons.platform.isAndroid() ? 48 : 44;
        }
    };
});

0 个答案:

没有答案